Files
risuai/package.json
shirosaki-hana c1d4b4daa3 Fix: Resolve Realm CORS Violation for Node.js Hosted Version
Problem:

The Node.js hosted version of RisuAI encountered an issue where it failed to fetch data from the Risu Realm server when accessed remotely.

RisuAI's frontend directly fetches data from the Realm server (e.g., sv.risuai.xyz). While the official web version did not exhibit CORS errors (potentially due to same-origin deployment or specific server-side CORS configurations), running the Node.js version on a self-hosted server and accessing it remotely resulted in browser CORS policy violations.

Solution:

The fix involves detecting when the frontend runs in the Node.js host environment.

When this environment is detected, instead of requesting Realm data directly from the external server (sv.risuai.xyz), the frontend now directs the request to a new proxy endpoint (`/hub-proxy/*`) on its own backend server.

The backend proxy then fetches the required data (including JSON and images) from the actual Realm server, correctly handles content types and compression, and relays the response back to the frontend.

This ensures that, from the browser's perspective, the frontend is communicating with its same-origin backend, effectively bypassing browser CORS restrictions and resolving the data fetching issue.
2025-04-10 17:16:21 +09:00

130 lines
3.9 KiB
JSON

{
"name": "risuai",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"tauri": "tauri",
"buildsite": "vite build --outDir dist",
"updatePlugin": "tsc public/pluginApi.ts",
"runserver": "node server/node/server.cjs",
"sync": "node electron/sync",
"electron": "node electron/dist/electron"
},
"dependencies": {
"@adobe/css-tools": "4.3.2",
"@aws-crypto/sha256-js": "^5.2.0",
"@breezystack/lamejs": "^1.2.7",
"@browsermt/bergamot-translator": "^0.4.9",
"@capacitor/android": "^5.6.0",
"@capacitor/core": "^5.6.0",
"@capacitor/filesystem": "^5.2.0",
"@dqbd/tiktoken": "^1.0.7",
"@huggingface/jinja": "^0.2.2",
"@huggingface/transformers": "^3.1.1",
"@mlc-ai/web-tokenizers": "^0.1.2",
"@risuai/ccardlib": "^0.4.1",
"@smithy/protocol-http": "^3.0.12",
"@smithy/signature-v4": "^2.0.19",
"@tauri-apps/api": "2.0.0",
"@tauri-apps/plugin-deep-link": "~2",
"@tauri-apps/plugin-dialog": "~2",
"@tauri-apps/plugin-fs": "~2",
"@tauri-apps/plugin-http": "~2",
"@tauri-apps/plugin-os": "~2",
"@tauri-apps/plugin-process": "~2",
"@tauri-apps/plugin-shell": "~2",
"@tauri-apps/plugin-updater": "~2",
"@types/markdown-it": "^14.1.1",
"blueimp-md5": "^2.19.0",
"body-parser": "^1.20.2",
"buffer": "^6.0.3",
"codemirror": "^5.65.16",
"compression-streams-polyfill": "^0.1.7",
"core-js": "^3.35.0",
"cors": "^2.8.5",
"crc": "^4.3.2",
"diff": "^7.0.0",
"dompurify": "^3.0.8",
"eventsource-parser": "^1.1.2",
"exifr": "^7.1.3",
"express": "^4.18.2",
"fflate": "^0.8.1",
"gpt-3-encoder": "^1.1.4",
"gpt3-tokenizer": "^1.1.5",
"highlight.js": "^11.9.0",
"html-to-image": "^1.11.11",
"isomorphic-dompurify": "^1.13.0",
"jszip": "^3.10.1",
"libsodium-wrappers-sumo": "^0.7.13",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"lucide-svelte": "^0.292.0",
"markdown-it": "^14.1.0",
"ml-distance": "^4.0.1",
"mobile-drag-drop": "3.0.0-rc.0",
"msgpackr": "1.10.1",
"node-fetch": "2",
"node-html-parser": "^6.1.12",
"ollama": "^0.5.0",
"pdfjs-dist": "^4.0.379",
"peerjs": "^1.5.2",
"png-chunk-text": "^1.0.0",
"png-chunks-encode": "^1.0.0",
"png-chunks-extract": "^1.0.0",
"rfdc": "^1.4.1",
"rollup": "^3.29.4",
"showdown": "^2.1.0",
"sortablejs": "^1.15.2",
"streamsaver": "^2.0.6",
"sv": "^0.6.5",
"svelte-awesome-color-picker": "^3.1.0",
"three": "^0.154.0",
"tippy.js": "^6.3.7",
"uuid": "^9.0.1",
"wasmoon": "^1.16.0",
"wavefile": "^11.0.0",
"web-streams-polyfill": "^3.3.2"
},
"devDependencies": {
"@capacitor/assets": "^3.0.4",
"@capacitor/cli": "^5.6.0",
"@rollup/plugin-strip": "^3.0.4",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@swc/core": "1.5.7",
"@tailwindcss/typography": "^0.5.10",
"@tauri-apps/cli": "2.0.2",
"@tsconfig/svelte": "^3.0.0",
"@types/blueimp-md5": "^2.18.2",
"@types/codemirror": "^5.60.15",
"@types/diff": "^6.0.0",
"@types/dompurify": "^3.0.5",
"@types/libsodium-wrappers-sumo": "^0.7.8",
"@types/lodash": "^4.14.202",
"@types/lodash.isequal": "^4.5.8",
"@types/node": "^18.19.7",
"@types/showdown": "^2.0.6",
"@types/sortablejs": "^1.15.7",
"@types/streamsaver": "^2.0.4",
"@types/three": "^0.154.0",
"@types/uuid": "^9.0.7",
"@types/wicg-file-system-access": "^2020.9.8",
"autoprefixer": "^10.4.16",
"internal-ip": "^7.0.0",
"postcss": "^8.4.33",
"svelte": "^5.1.9",
"svelte-check": "^4.0.5",
"svelte-preprocess": "^6.0.0",
"tailwindcss": "^3.4.1",
"tslib": "^2.6.2",
"typescript": "^5.5.0",
"vite": "^5.4.4",
"vite-plugin-top-level-await": "1.4.1",
"vite-plugin-wasm": "3.3.0"
}
}