[#21] changed react-script to rebuild
This commit is contained in:
+9
-9
@@ -1,9 +1,9 @@
|
|||||||
REACT_APP_SSO_BASE_URL="https://example.com"
|
PUBLIC_SSO_BASE_URL="https://example.com"
|
||||||
REACT_APP_SSO_CLIENT_ID="example"
|
PUBLIC_SSO_CLIENT_ID="example"
|
||||||
REACT_APP_SSO_CLIENT_SECRET=""
|
PUBLIC_SSO_CLIENT_SECRET=""
|
||||||
REACT_APP_SSO_SCOPE="openid name email"
|
PUBLIC_SSO_SCOPE="openid name email"
|
||||||
REACT_APP_SSO_REDIRECT_URI="https://example.com/callback"
|
PUBLIC_SSO_REDIRECT_URI="https://example.com/callback"
|
||||||
REACT_APP_SSO_RESPONSE_TYPE="code"
|
PUBLIC_SSO_RESPONSE_TYPE="code"
|
||||||
REACT_APP_SSO_CODE_CHALLENGE_METHOD="S256"
|
PUBLIC_SSO_CODE_CHALLENGE_METHOD="S256"
|
||||||
REACT_APP_SSO_POST_LOGOUT_REDIRECT="http://example.com?logout=1"
|
PUBLIC_SSO_POST_LOGOUT_REDIRECT="http://example.com?logout=1"
|
||||||
REACT_APP_CALENDAR_BASE_URL="https://calendar.example.com"
|
PUBLIC_CALENDAR_BASE_URL="https://calendar.example.com"
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
/coverage
|
/coverage
|
||||||
|
|
||||||
# production
|
# production
|
||||||
/build
|
/dist
|
||||||
|
|
||||||
# secrets
|
# secrets
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
Generated
+2789
-7219
File diff suppressed because it is too large
Load Diff
+9
-4
@@ -29,10 +29,11 @@
|
|||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "PORT=5000 react-scripts start",
|
"start": "PORT=5000 rsbuild dev",
|
||||||
"build": "react-scripts build",
|
"build": "rsbuild build",
|
||||||
|
"preview": "rsbuild preview",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"lint": "eslint src"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
@@ -53,15 +54,19 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@rsbuild/core": "^1.4.3",
|
||||||
|
"@rsbuild/plugin-react": "^1.3.3",
|
||||||
|
"@rsbuild/plugin-svgr": "^1.2.0",
|
||||||
"@testing-library/dom": "^10.4.0",
|
"@testing-library/dom": "^10.4.0",
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"@types/jest": "^27.5.2",
|
"@types/jest": "^27.5.2",
|
||||||
|
"eslint": "^8.57.1",
|
||||||
|
"eslint-config-react-app": "^7.0.1",
|
||||||
"i18next-resources-for-ts": "1.4.0",
|
"i18next-resources-for-ts": "1.4.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"jest-preview": "^0.3.1",
|
"jest-preview": "^0.3.1",
|
||||||
"react-scripts": "^5.0.1",
|
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -2,25 +2,25 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
<link rel="icon" href="<%= assetPrefix %>/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
name="description"
|
||||||
content="Web site created using create-react-app"
|
content="Web site created using create-react-app"
|
||||||
/>
|
/>
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
<link rel="apple-touch-icon" href="<%= assetPrefix %>/logo192.png" />
|
||||||
<!--
|
<!--
|
||||||
manifest.json provides metadata used when your web app is installed on a
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
-->
|
-->
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
<link rel="manifest" href="<%= assetPrefix %>/manifest.json" />
|
||||||
<!--
|
<!--
|
||||||
Notice the use of %PUBLIC_URL% in the tags above.
|
Notice the use of <%= assetPrefix %> in the tags above.
|
||||||
It will be replaced with the URL of the `public` folder during the build.
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
Only files inside the `public` folder can be referenced from the HTML.
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
Unlike "/favicon.ico" or "favicon.ico", "<%= assetPrefix %>/favicon.ico" will
|
||||||
work correctly both with client-side routing and a non-root public URL.
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { defineConfig } from "@rsbuild/core";
|
||||||
|
import { pluginReact } from "@rsbuild/plugin-react";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [pluginReact()],
|
||||||
|
html: {
|
||||||
|
template: "./public/index.html",
|
||||||
|
},
|
||||||
|
server: { port: 5000 },
|
||||||
|
});
|
||||||
@@ -2,7 +2,7 @@ import { cp } from "node:fs";
|
|||||||
|
|
||||||
export async function getCalendars(userId: string, opaque_token: string) {
|
export async function getCalendars(userId: string, opaque_token: string) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${process.env.REACT_APP_CALENDAR_BASE_URL}/dav/calendars/${userId}.json?personal=true&sharedDelegationStatus=accepted&sharedPublicSubscription=true&withRights=true`,
|
`${process.env.PUBLIC_CALENDAR_BASE_URL}/dav/calendars/${userId}.json?personal=true&sharedDelegationStatus=accepted&sharedPublicSubscription=true&withRights=true`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/calendar+json",
|
Accept: "application/calendar+json",
|
||||||
@@ -16,7 +16,7 @@ export async function getCalendars(userId: string, opaque_token: string) {
|
|||||||
|
|
||||||
export async function getCalendar(id: string, opaque_token: string) {
|
export async function getCalendar(id: string, opaque_token: string) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${process.env.REACT_APP_CALENDAR_BASE_URL}/dav/calendars/${id}/${id}.json`,
|
`${process.env.PUBLIC_CALENDAR_BASE_URL}/dav/calendars/${id}/${id}.json`,
|
||||||
{
|
{
|
||||||
method: "REPORT",
|
method: "REPORT",
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ const CalendarSlice = createSlice({
|
|||||||
state,
|
state,
|
||||||
action: PayloadAction<{ calendarUid: string; event: CalendarEvent }>
|
action: PayloadAction<{ calendarUid: string; event: CalendarEvent }>
|
||||||
) => {
|
) => {
|
||||||
console.log(action.payload);
|
|
||||||
if (!state[action.payload.calendarUid].events) {
|
if (!state[action.payload.calendarUid].events) {
|
||||||
state[action.payload.calendarUid].events = [];
|
state[action.payload.calendarUid].events = [];
|
||||||
}
|
}
|
||||||
@@ -81,10 +80,7 @@ const CalendarSlice = createSlice({
|
|||||||
builder.addCase(
|
builder.addCase(
|
||||||
getCalendarsAsync.fulfilled,
|
getCalendarsAsync.fulfilled,
|
||||||
(state, action: PayloadAction<Record<string, Calendars>>) => {
|
(state, action: PayloadAction<Record<string, Calendars>>) => {
|
||||||
console.log("ony est!!!!: ", action.payload);
|
|
||||||
console.log(Object.keys(action.payload));
|
|
||||||
Object.keys(action.payload).forEach((id) => {
|
Object.keys(action.payload).forEach((id) => {
|
||||||
console.log(id);
|
|
||||||
state[id] = action.payload[id];
|
state[id] = action.payload[id];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ export function parseCalendarEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!event.uid || !event.start) {
|
if (!event.uid || !event.start) {
|
||||||
console.log(event);
|
|
||||||
throw new Error(`Missing required event fields`);
|
throw new Error(`Missing required event fields`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export function CallbackResume() {
|
|||||||
const runCallback = async () => {
|
const runCallback = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await Callback(saved?.code_verifier, saved?.state);
|
const data = await Callback(saved?.code_verifier, saved?.state);
|
||||||
console.log("data:", data);
|
|
||||||
dispatch(setUserData(data?.userinfo));
|
dispatch(setUserData(data?.userinfo));
|
||||||
dispatch(setTokens(data?.tokenSet));
|
dispatch(setTokens(data?.tokenSet));
|
||||||
dispatch(getCalendarsAsync(data?.tokenSet.access_token || ""));
|
dispatch(getCalendarsAsync(data?.tokenSet.access_token || ""));
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
import * as client from "openid-client";
|
import * as client from "openid-client";
|
||||||
|
|
||||||
export const clientConfig = {
|
export const clientConfig = {
|
||||||
url: process.env.REACT_APP_SSO_BASE_URL || "",
|
url: process.env.PUBLIC_SSO_BASE_URL || "",
|
||||||
client_id: process.env.REACT_APP_SSO_CLIENT_ID || "",
|
client_id: process.env.PUBLIC_SSO_CLIENT_ID || "",
|
||||||
client_secret: process.env.REACT_APP_SSO_CLIENT_SECRET || "",
|
client_secret: process.env.PUBLIC_SSO_CLIENT_SECRET || "",
|
||||||
scope: process.env.REACT_APP_SSO_SCOPE || "",
|
scope: process.env.PUBLIC_SSO_SCOPE || "",
|
||||||
redirect_uri: process.env.REACT_APP_SSO_REDIRECT_URI || "",
|
redirect_uri: process.env.PUBLIC_SSO_REDIRECT_URI || "",
|
||||||
response_type: process.env.REACT_APP_SSO_RESPONSE_TYPE || "",
|
response_type: process.env.PUBLIC_SSO_RESPONSE_TYPE || "",
|
||||||
code_challenge_method: process.env.REACT_APP_SSO_CODE_CHALLENGE_METHOD || "",
|
code_challenge_method: process.env.PUBLIC_SSO_CODE_CHALLENGE_METHOD || "",
|
||||||
post_logout_redirect_uri:
|
post_logout_redirect_uri:
|
||||||
process.env.REACT_APP_SSO_POST_LOGOUT_REDIRECT || "",
|
process.env.PUBLIC_SSO_POST_LOGOUT_REDIRECT || "",
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getClientConfig() {
|
export async function getClientConfig() {
|
||||||
console.log(process.env.REACT_APP_SSO_BASE_URL)
|
|
||||||
return await client.discovery(
|
return await client.discovery(
|
||||||
new URL(clientConfig.url),
|
new URL(clientConfig.url),
|
||||||
clientConfig.client_id,
|
clientConfig.client_id,
|
||||||
@@ -37,7 +36,6 @@ export async function Auth() {
|
|||||||
parameters.state = state;
|
parameters.state = state;
|
||||||
}
|
}
|
||||||
let redirectTo = client.buildAuthorizationUrl(openIdClientConfig, parameters);
|
let redirectTo = client.buildAuthorizationUrl(openIdClientConfig, parameters);
|
||||||
console.log(redirectTo);
|
|
||||||
|
|
||||||
return { redirectTo, code_verifier, state };
|
return { redirectTo, code_verifier, state };
|
||||||
}
|
}
|
||||||
@@ -58,7 +56,6 @@ export async function Callback(code_verifier: string, state: any) {
|
|||||||
|
|
||||||
console.log("Callback URL:", currentUrl.toString());
|
console.log("Callback URL:", currentUrl.toString());
|
||||||
console.log("Code verifier:", code_verifier);
|
console.log("Code verifier:", code_verifier);
|
||||||
console.log("State:", state);
|
|
||||||
|
|
||||||
const tokenSet = await client.authorizationCodeGrant(
|
const tokenSet = await client.authorizationCodeGrant(
|
||||||
openIdClientConfig,
|
openIdClientConfig,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export default async function getOpenPaasUserId(opaque_token: string) {
|
export default async function getOpenPaasUserId(opaque_token: string) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${process.env.REACT_APP_CALENDAR_BASE_URL}/api/user`,
|
`${process.env.PUBLIC_CALENDAR_BASE_URL}/api/user`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${opaque_token}`,
|
Authorization: `Bearer ${opaque_token}`,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export const userSlice = createSlice({
|
|||||||
state.organiserData.cal_address = `mailto:${action.payload.email}`;
|
state.organiserData.cal_address = `mailto:${action.payload.email}`;
|
||||||
},
|
},
|
||||||
setTokens: (state, action) => {
|
setTokens: (state, action) => {
|
||||||
console.log(state.tokens);
|
|
||||||
state.tokens = action.payload;
|
state.tokens = action.payload;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user