[Attempt 1] fix slow website
Some checks failed
Queue Release Build / prepare (push) Successful in 25s
Deploy Web Apps / deploy (push) Successful in 17m20s
Queue Release Build / finalize (push) Has been cancelled
Queue Release Build / build-linux (push) Has started running
Queue Release Build / build-windows (push) Has been cancelled

This commit is contained in:
2026-03-13 02:46:21 +01:00
parent 22d355a522
commit 2b6e477c9a
3 changed files with 19 additions and 13 deletions

View File

@@ -64,7 +64,12 @@
"scripts": [],
"server": "src/main.server.ts",
"security": {
"allowedHosts": []
"allowedHosts": [
"toju.app",
"www.toju.app",
"localhost",
"127.0.0.1"
]
},
"prerender": true,
"ssr": {

View File

@@ -246,15 +246,6 @@ export class ReleaseService {
}
private getReleaseEndpoints(): string[] {
if (!isPlatformBrowser(this.platformId)) {
return [PROXY_RELEASES_API_URL, DIRECT_RELEASES_API_URL];
}
const hostname = window.location.hostname;
const isLocalHost = hostname === 'localhost' || hostname === '127.0.0.1';
return isLocalHost
? [PROXY_RELEASES_API_URL, DIRECT_RELEASES_API_URL]
: [DIRECT_RELEASES_API_URL, PROXY_RELEASES_API_URL];
return [PROXY_RELEASES_API_URL, DIRECT_RELEASES_API_URL];
}
}

View File

@@ -13,7 +13,16 @@ const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
const indexHtml = join(serverDistFolder, 'index.server.html');
const app = express();
const commonEngine = new CommonEngine();
const commonEngine = new CommonEngine({
allowedHosts: [
'toju.app',
'www.toju.app',
'localhost',
'127.0.0.1'
]
});
app.set('trust proxy', 'loopback');
/**
* Proxy endpoint for Gitea releases API to avoid CORS issues.
@@ -51,7 +60,8 @@ app.get(
'**',
express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html'
index: 'index.html',
redirect: false
})
);