Skip to content

Commit

Permalink
fix: auto update issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chroxify committed Sep 3, 2024
1 parent 0009c4a commit d640c93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 4 additions & 2 deletions apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "Haptic",
"version": "0.1.2"
"version": "0.1.3"
},
"tauri": {
"allowlist": {
Expand Down Expand Up @@ -56,7 +56,9 @@
},
"updater": {
"active": true,
"endpoints": ["https://releases.myapp.com/{{target}}/{{arch}}/{{current_version}}"],
"endpoints": [
"https://haptic.md/api/check-updates?target={{target}}&arch={{arch}}&currentVersion={{current_version}}"
],
"dialog": true,
"windows": {
"installMode": "passive"
Expand Down
24 changes: 11 additions & 13 deletions apps/homepage/src/routes/api/check-updates/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ export const GET: RequestHandler = async ({ url }) => {
const arch = url.searchParams.get('arch') as Arch | undefined;

// Parse target and arch and validate with type
if (!target || !arch) {
if (!target || !arch || !currentVersion) {
return new Response(
JSON.stringify({
error: 'Missing required parameters. Please provide target, arch, and currentVersion.'
}),
{
status: 400,
headers: { 'Content-Type': 'application/json' }
}
);
}
if (!target || !arch || !currentVersion) {
return new Response(
JSON.stringify({
error: 'Missing required parameters. Please provide target, arch, and currentVersion.'
}),
{
status: 400,
headers: { 'Content-Type': 'application/json' }
}
);
}

// Validate target
Expand Down Expand Up @@ -64,7 +62,7 @@ export const GET: RequestHandler = async ({ url }) => {
const edgeConfig = (await configClient.getAll()) as { latest_version: string; notes?: string };

// Validate versions
if (currentVersion === edgeConfig.latest_version) {
if (currentVersion.replace('v', '') === edgeConfig.latest_version.replace('v', '')) {
return new Response(null, { status: 204 });
}

Expand Down

0 comments on commit d640c93

Please sign in to comment.