Compare commits
1 Commits
v1.0.46
...
c8814c3e2c
| Author | SHA1 | Date | |
|---|---|---|---|
| c8814c3e2c |
@@ -92,7 +92,7 @@ function buildDefaultServerUrl(): string {
|
|||||||
|
|
||||||
/** Blueprint for the built-in default endpoint. */
|
/** Blueprint for the built-in default endpoint. */
|
||||||
const DEFAULT_ENDPOINT: Omit<ServerEndpoint, 'id'> = {
|
const DEFAULT_ENDPOINT: Omit<ServerEndpoint, 'id'> = {
|
||||||
name: 'Default Server',
|
name: 'Local Server',
|
||||||
url: buildDefaultServerUrl(),
|
url: buildDefaultServerUrl(),
|
||||||
isActive: true,
|
isActive: true,
|
||||||
isDefault: true,
|
isDefault: true,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
defaultServerUrl: 'https://signal.toju.app'
|
defaultServerUrl: 'https://tojusignal.azaaxin.com'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ function Invoke-RoboCopyMirror {
|
|||||||
if ($LASTEXITCODE -gt 7) {
|
if ($LASTEXITCODE -gt 7) {
|
||||||
throw "robocopy failed from $Source to $Destination with exit code $LASTEXITCODE"
|
throw "robocopy failed from $Source to $Destination with exit code $LASTEXITCODE"
|
||||||
}
|
}
|
||||||
|
|
||||||
$global:LASTEXITCODE = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Ensure-AppPool {
|
function Ensure-AppPool {
|
||||||
@@ -101,5 +99,3 @@ $deployments = @(
|
|||||||
foreach ($deployment in $deployments) {
|
foreach ($deployment in $deployments) {
|
||||||
Publish-IisSite @deployment
|
Publish-IisSite @deployment
|
||||||
}
|
}
|
||||||
|
|
||||||
$global:LASTEXITCODE = 0
|
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ const ARCHIVE_SUFFIXES = [
|
|||||||
'.7z',
|
'.7z',
|
||||||
'.rar'
|
'.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 {
|
function matchesAssetPattern(name: string, suffixes: string[], hints: string[] = []): boolean {
|
||||||
if (suffixes.some((suffix) => name.endsWith(suffix))) {
|
if (suffixes.some((suffix) => name.endsWith(suffix))) {
|
||||||
@@ -207,7 +205,15 @@ export class ReleaseService {
|
|||||||
|
|
||||||
private async fetchReleasesInternal(): Promise<Release[]> {
|
private async fetchReleasesInternal(): Promise<Release[]> {
|
||||||
try {
|
try {
|
||||||
const data = await this.fetchReleasesFromAvailableEndpoints();
|
const response = await fetch('/api/releases', {
|
||||||
|
headers: { Accept: 'application/json' }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
this.cachedReleases = Array.isArray(data) ? data : [data];
|
this.cachedReleases = Array.isArray(data) ? data : [data];
|
||||||
|
|
||||||
@@ -220,41 +226,4 @@ export class ReleaseService {
|
|||||||
this.fetchPromise = null;
|
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];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user