mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-15 09:20:12 +00:00
fix: add timeout to update check
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { version as currentVersion } from '$app/environment';
|
import { version as currentVersion } from '$app/environment';
|
||||||
import type { AllAppConfig, AppConfigRawResponse } from '$lib/types/application-configuration';
|
import type { AllAppConfig, AppConfigRawResponse } from '$lib/types/application-configuration';
|
||||||
import axios, { AxiosError } from 'axios';
|
import axios from 'axios';
|
||||||
import APIService from './api-service';
|
import APIService from './api-service';
|
||||||
|
|
||||||
export default class AppConfigService extends APIService {
|
export default class AppConfigService extends APIService {
|
||||||
@@ -57,15 +57,11 @@ export default class AppConfigService extends APIService {
|
|||||||
|
|
||||||
async getVersionInformation() {
|
async getVersionInformation() {
|
||||||
const response = await axios
|
const response = await axios
|
||||||
.get('https://api.github.com/repos/pocket-id/pocket-id/releases/latest')
|
.get('https://api.github.com/repos/pocket-id/pocket-id/releases/latest', {
|
||||||
|
timeout: 2000
|
||||||
|
})
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
.catch((e) => {
|
.catch(() => null);
|
||||||
console.error(
|
|
||||||
'Failed to fetch version information',
|
|
||||||
e instanceof AxiosError && e.response ? e.response.data.message : e
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
let newestVersion: string | null = null;
|
let newestVersion: string | null = null;
|
||||||
let isUpToDate: boolean | null = null;
|
let isUpToDate: boolean | null = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user