2 Commits

Author SHA1 Message Date
Myx
7bf37ba510 Website v3
All checks were successful
Queue Release Build / prepare (push) Successful in 39s
Deploy Web Apps / deploy (push) Successful in 16m30s
Queue Release Build / build-linux (push) Successful in 52m31s
Queue Release Build / build-windows (push) Successful in 36m48s
Queue Release Build / finalize (push) Successful in 3m20s
2026-03-12 14:32:48 +01:00
Myx
3c04b5db26 Add webapp release
Some checks failed
Queue Release Build / prepare (push) Successful in 50s
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / finalize (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled
Deploy Web Apps / deploy (push) Has been cancelled
2026-03-12 13:37:46 +01:00
4 changed files with 46 additions and 11 deletions

View File

@@ -92,7 +92,7 @@ function buildDefaultServerUrl(): string {
/** Blueprint for the built-in default endpoint. */
const DEFAULT_ENDPOINT: Omit<ServerEndpoint, 'id'> = {
name: 'Local Server',
name: 'Default Server',
url: buildDefaultServerUrl(),
isActive: true,
isDefault: true,

View File

@@ -1,4 +1,4 @@
export const environment = {
production: true,
defaultServerUrl: 'https://tojusignal.azaaxin.com'
defaultServerUrl: 'https://signal.toju.app'
};

View File

@@ -34,6 +34,8 @@ function Invoke-RoboCopyMirror {
if ($LASTEXITCODE -gt 7) {
throw "robocopy failed from $Source to $Destination with exit code $LASTEXITCODE"
}
$global:LASTEXITCODE = 0
}
function Ensure-AppPool {
@@ -99,3 +101,5 @@ $deployments = @(
foreach ($deployment in $deployments) {
Publish-IisSite @deployment
}
$global:LASTEXITCODE = 0

View File

@@ -55,6 +55,8 @@ const ARCHIVE_SUFFIXES = [
'.7z',
'.rar'
];
const DIRECT_RELEASES_API_URL = 'https://git.azaaxin.com/api/v1/repos/myxelium/Toju/releases';
const PROXY_RELEASES_API_URL = '/api/releases';
function matchesAssetPattern(name: string, suffixes: string[], hints: string[] = []): boolean {
if (suffixes.some((suffix) => name.endsWith(suffix))) {
@@ -205,15 +207,7 @@ export class ReleaseService {
private async fetchReleasesInternal(): Promise<Release[]> {
try {
const response = await fetch('/api/releases', {
headers: { Accept: 'application/json' }
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
const data = await this.fetchReleasesFromAvailableEndpoints();
this.cachedReleases = Array.isArray(data) ? data : [data];
@@ -226,4 +220,41 @@ export class ReleaseService {
this.fetchPromise = null;
}
}
private async fetchReleasesFromAvailableEndpoints(): Promise<Release[] | Release> {
let lastError: unknown = null;
for (const endpoint of this.getReleaseEndpoints()) {
try {
const response = await fetch(endpoint, {
headers: { Accept: 'application/json' }
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return await response.json();
} catch (error) {
lastError = error;
}
}
throw lastError instanceof Error
? lastError
: new Error('Failed to fetch releases from all configured endpoints.');
}
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];
}
}