Skip to content

Commit d640c93

Browse files
committed
fix: auto update issues
1 parent 0009c4a commit d640c93

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

apps/desktop/src-tauri/tauri.conf.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "Haptic",
11-
"version": "0.1.2"
11+
"version": "0.1.3"
1212
},
1313
"tauri": {
1414
"allowlist": {
@@ -56,7 +56,9 @@
5656
},
5757
"updater": {
5858
"active": true,
59-
"endpoints": ["https://releases.myapp.com/{{target}}/{{arch}}/{{current_version}}"],
59+
"endpoints": [
60+
"https://haptic.md/api/check-updates?target={{target}}&arch={{arch}}&currentVersion={{current_version}}"
61+
],
6062
"dialog": true,
6163
"windows": {
6264
"installMode": "passive"

apps/homepage/src/routes/api/check-updates/+server.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ export const GET: RequestHandler = async ({ url }) => {
1919
const arch = url.searchParams.get('arch') as Arch | undefined;
2020

2121
// Parse target and arch and validate with type
22-
if (!target || !arch) {
23-
if (!target || !arch || !currentVersion) {
24-
return new Response(
25-
JSON.stringify({
26-
error: 'Missing required parameters. Please provide target, arch, and currentVersion.'
27-
}),
28-
{
29-
status: 400,
30-
headers: { 'Content-Type': 'application/json' }
31-
}
32-
);
33-
}
22+
if (!target || !arch || !currentVersion) {
23+
return new Response(
24+
JSON.stringify({
25+
error: 'Missing required parameters. Please provide target, arch, and currentVersion.'
26+
}),
27+
{
28+
status: 400,
29+
headers: { 'Content-Type': 'application/json' }
30+
}
31+
);
3432
}
3533

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

6664
// Validate versions
67-
if (currentVersion === edgeConfig.latest_version) {
65+
if (currentVersion.replace('v', '') === edgeConfig.latest_version.replace('v', '')) {
6866
return new Response(null, { status: 204 });
6967
}
7068

0 commit comments

Comments
 (0)