Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
454 changes: 454 additions & 0 deletions docs/develop/account-web-sign-in-migration.md

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions spx-gui/.env
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ VITE_USERCONTENT_BUCKET=""
# NOTE: Must be synchronized with `KODO_BUCKET_REGION` in spx-backend `.env` file.
VITE_USERCONTENT_UPLOAD_BASE_URL=""

# Casdoor configuration.
# Account OAuth configuration for the main-site hosted sign-in flow.
#
# Required.
VITE_CASDOOR_ENDPOINT=""
VITE_CASDOOR_CLIENT_ID=""
VITE_CASDOOR_APP_NAME=""
VITE_CASDOOR_ORGANIZATION_NAME=""
# Required when enabling the new Account OAuth flow.
VITE_ACCOUNT_OAUTH_CLIENT_ID=""


# Feature flags, all boolean (true/false), with default values set here.
#
Expand Down
6 changes: 2 additions & 4 deletions spx-gui/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ VITE_USERCONTENT_BASE_URL="https://builder-usercontent.gopluscdn.com"
VITE_USERCONTENT_BUCKET="goplus-builder-usercontent"
VITE_USERCONTENT_UPLOAD_BASE_URL="https://upload-na0.qiniup.com"

VITE_CASDOOR_ENDPOINT="https://acc.xbuilder.com"
VITE_CASDOOR_CLIENT_ID="4ff910257e9cdd89b6b8"
VITE_CASDOOR_APP_NAME="goplus-builder"
VITE_CASDOOR_ORGANIZATION_NAME="GoPlus"
# TODO: Update to the correct production clientID when it's ready.
VITE_ACCOUNT_OAUTH_CLIENT_ID="2"

VITE_SENTRY_DSN="https://0d463740215eb87f7e06f6572d64c93e@o4509472134987776.ingest.us.sentry.io/4509472136167424"
11 changes: 5 additions & 6 deletions spx-gui/.env.staging
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Config for env staging

VITE_API_BASE_URL="https://goplus-builder-api.qiniu.io"
VITE_VERCEL_PROXIED_API_BASE_URL="https://goplus-builder-api.qiniu.io"
# VITE_API_BASE_URL="https://goplus-builder-api.qiniu.io"
# VITE_VERCEL_PROXIED_API_BASE_URL="https://goplus-builder-api.qiniu.io"
VITE_API_BASE_URL="https://goplus-builder-api-test-acc.qiniu.io"
VITE_VERCEL_PROXIED_API_BASE_URL="https://goplus-builder-api-test-acc.qiniu.io"

VITE_USERCONTENT_BASE_URL="https://xbuilder-usercontent-test.gopluscdn.com"
VITE_USERCONTENT_BUCKET="xbuilder-usercontent-test"
VITE_USERCONTENT_UPLOAD_BASE_URL="https://upload.qiniup.com"

VITE_CASDOOR_ENDPOINT="https://goplus-casdoor.qiniu.io"
VITE_CASDOOR_CLIENT_ID="389313df51ffd2093b2f"
VITE_CASDOOR_APP_NAME="goplus-builder"
VITE_CASDOOR_ORGANIZATION_NAME="GoPlus"
VITE_ACCOUNT_OAUTH_CLIENT_ID="2"

VITE_SENTRY_DSN="https://0d463740215eb87f7e06f6572d64c93e@o4509472134987776.ingest.us.sentry.io/4509472136167424"

Expand Down
30 changes: 30 additions & 0 deletions spx-gui/Dockerfile.account
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG NODE_BASE_IMAGE=node:24.11.1
ARG NGINX_BASE_IMAGE=nginx:1.27

FROM ${NODE_BASE_IMAGE} AS frontend-builder

WORKDIR /app/spx-gui

COPY spx-gui/package.json spx-gui/package-lock.json .

ARG NPM_CONFIG_REGISTRY
RUN npm install --ignore-scripts

COPY spx-gui/account.html spx-gui/vite.config.account.ts spx-gui/vercel-output-plugin.ts .
COPY spx-gui/tsconfig.json spx-gui/tsconfig.app.json spx-gui/tsconfig.node.json .
COPY spx-gui/.env spx-gui/.env.production spx-gui/.env.staging .
COPY spx-gui/public ./public
COPY spx-gui/src ./src

ARG NODE_ENV=production
ENV NODE_OPTIONS=--max-old-space-size=4096
RUN NODE_ENV=${NODE_ENV} npx vite build --config vite.config.account.ts --mode ${NODE_ENV}

FROM ${NGINX_BASE_IMAGE}

COPY --from=frontend-builder /app/spx-gui/dist /usr/share/nginx/html
COPY spx-gui/nginx.account.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
24 changes: 24 additions & 0 deletions spx-gui/account.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>XBuilder Account</title>
<link rel="icon" href="/src/assets/logo.svg" />
<style>
@layer theme, base, components, utilities;

html,
body,
#app {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="./src/apps/account/main.ts"></script>
</body>
</html>

64 changes: 64 additions & 0 deletions spx-gui/deployment.account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: builder-account
namespace: builder
labels:
app: builder-account
spec:
replicas: 1
selector:
matchLabels:
app: builder-account
template:
metadata:
labels:
app: builder-account
spec:
imagePullSecrets:
- name: ghcr-nighca
containers:
- name: builder-account
image: ghcr.io/nighca/builder-account:test
ports:
- name: http
containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: builder-account
namespace: builder
labels:
app: builder-account
spec:
type: ClusterIP
selector:
app: builder-account
ports:
- name: http
port: 80
targetPort: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: builder-account
namespace: builder
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 300m
nginx.ingress.kubernetes.io/proxy-buffering: 'off'
nginx.ingress.kubernetes.io/proxy-http-version: '1.1'
nginx.ingress.kubernetes.io/proxy-request-buffering: 'off'
spec:
rules:
- host: goplus-builder-account.qiniu.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: builder-account
port:
number: 80
2 changes: 1 addition & 1 deletion spx-gui/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default defineConfigWithVueTs(

{
name: 'app/pages-rules',
files: ['src/pages/**/*.vue'],
files: ['src/apps/xbuilder/pages/**/*.vue'],
rules: {
// Page components will not be used by name in other components' template.
// Disable this rule to simplify naming of page components.
Expand Down
2 changes: 1 addition & 1 deletion spx-gui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/apps/xbuilder/main.ts"></script>
</body>
</html>
54 changes: 54 additions & 0 deletions spx-gui/nginx.account.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
server {
listen 80 default_server;
server_name _;

client_max_body_size 200M;

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_min_length 1024;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;

add_header 'Cross-Origin-Embedder-Policy' 'require-corp' always;
add_header 'Cross-Origin-Opener-Policy' 'same-origin' always;

location /assets/ {
add_header 'Cross-Origin-Embedder-Policy' 'require-corp' always;
add_header 'Cross-Origin-Opener-Policy' 'same-origin' always;
add_header 'Cache-Control' 'public, max-age=31536000, immutable' always;

root /usr/share/nginx/html;
try_files $uri =404;
}

location = /api {
proxy_pass http://test-acc-spx-backend/account;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /api/ {
proxy_pass http://test-acc-spx-backend/account/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
34 changes: 0 additions & 34 deletions spx-gui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions spx-gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"dev": "vite",
"build": "./build-tutorial-books.sh && vue-tsc --build --force && NODE_ENV=production vite build --mode ${NODE_ENV:-production}",
"preview": "vite preview",
"dev:account": "vite --config vite.config.account.ts --port 5174",
"build:account": "vue-tsc --build --force && NODE_ENV=production vite build --config vite.config.account.ts --mode ${NODE_ENV:-production}",
"type-check": "vue-tsc --build --force",
"format-check": "prettier --check ./src",
"format": "prettier --write ./src",
Expand Down Expand Up @@ -39,7 +41,6 @@
"bowser": "^2.14.1",
"browserslist": "^4.28.0",
"browserslist-to-esbuild": "^2.1.1",
"casdoor-js-sdk": "^0.16.0",
"cropperjs": "^2.1.0",
"csv-stringify": "^6.5.2",
"dayjs": "^1.11.10",
Expand All @@ -51,7 +52,6 @@
"hast": "^1.0.0",
"hast-util-raw": "^9.1.0",
"hast-util-sanitize": "^5.0.2",
"jwt-decode": "^4.0.0",
"konva": "^9.3.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
Expand Down
Loading