Commit Graph

19 Commits

Author SHA1 Message Date
shirosaki-hana
1b62dc95ed Add duplex 2025-04-18 13:18:37 +09:00
shirosaki-hana
5168565b4f Update : server.cjs 2025-04-17 17:31:46 +09:00
shirosaki-hana
e0038749a4 Fix: Resolve account login issues in Node.js hosted version
In a previous commit, a new proxy endpoint was added to the backend to resolve CORS errors that occurred when the frontend directly fetched data from Risu Realm.

However, the proxy endpoint handler failed to properly process POST requests, causing account login failures. Additionally, the backend was inefficiently performing complex body processing.

The updated code now directly pipes the original request, providing a more efficient and reliable solution.
2025-04-17 13:14:12 +09:00
shirosaki-hana
e2ae651557 Update server.cjs 2025-04-11 17:29:42 +09:00
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
shirosaki-hana
f4d3f40ce5 Add HTTPS support for RisuAI Node.js hosting version
The Node.js hosting version of RisuAI previously used simple app.listen for server execution, which didn't support native HTTPS. This caused several functionality issues due to browser security restrictions when accessing RisuAI externally, such as realm loading failures and inability to insert prompt presets.

The updated code now checks for certificate files named server.key and server.crt in the /server/node/ssl/certificate directory. If found, the server will start using HTTPS.

The /ssl directory includes a script to generate a self-signed SSL certificate using OpenSSL. To use it, add the server's public IP to the [ alt_names ] section in server.conf before generating the certificate. The CA certificate should be installed on the operating system or browser of devices remotely accessing RisuAI.

For production use with a domain, it's recommended to use a certificate from an official Certificate Authority.
2025-03-20 15:40:11 +09:00
Junha Heo
fff99d134e refactor: Update server.js to use express.json and express.raw for request parsing 2024-08-25 21:00:47 +09:00
Yuhwan Kim
7f3045bccb Reapply Base64 encoding to /api/list 2024-06-05 02:22:05 +09:00
Yuhwan Kim
de5d6a32bf Enhance Node Backend Server File I/O Performance 2024-06-05 01:25:16 +09:00
ModMapper
7f7d469606 Fixed a bug caused by the Content-Encoding header returned from the server in some environments 2024-04-08 01:09:46 +09:00
hashcoko
b69f31caae add nai diffusion
Signed-off-by: hashcoko <hashcoko@gmail.com>
2023-11-27 07:13:22 +09:00
kwaroran
24eb67744b [feat] new node proxy 2023-09-09 09:18:44 +09:00
kwaroran
16d567ed9f [fix] git 2023-09-09 09:07:27 +09:00
kwaroran
44accff661 [fix] node issue 2023-09-09 09:06:00 +09:00
kwaroran
ed1adaa4ae [refactor] proxy url by header for node server 2023-07-07 06:30:59 +09:00
kwaroran
ead670516d [refactor] proxy2 2023-07-07 06:20:02 +09:00
kwaroran
d084f1eb1e [fix] node server secutity 2023-05-29 17:37:28 +09:00
kwaroran
74f7625516 [feat] nodejs hosting password 2023-05-28 01:33:05 +09:00
kwaroran
205cc2744f [feat] node hosting support 2023-05-27 23:15:23 +09:00