Fix Capacitor dependencies - use built-in HTTP instead of separate plugin

This commit is contained in:
southseact-3d
2026-02-16 09:46:35 +00:00
parent 14f0e18ad4
commit df93012130
3 changed files with 6 additions and 9 deletions

View File

@@ -1,5 +1,4 @@
import { Preferences } from '@capacitor/preferences';
import { Http } from '@capacitor/http';
const BACKEND_BASE_URL = window.BACKEND_BASE_URL || 'https://api.example.com';
@@ -17,20 +16,19 @@ export async function syncApp(appId) {
const appData = JSON.parse(value);
const response = await Http.request({
const response = await fetch(`${BACKEND_BASE_URL}/desktop/apps/sync`, {
method: 'POST',
url: `${BACKEND_BASE_URL}/desktop/apps/sync`,
headers: {
'Content-Type': 'application/json',
},
data: appData,
body: JSON.stringify(appData),
});
if (response.status < 200 || response.status >= 300) {
if (!response.ok) {
throw new Error(`Sync failed: ${response.status}`);
}
return response.data;
return response.json();
}
export async function runOpencodeTask(appId, taskName, args = []) {

View File

@@ -6,7 +6,7 @@
"androidScheme": "https"
},
"plugins": {
"Http": {
"CapacitorHttp": {
"enabled": true
},
"Preferences": {

View File

@@ -14,8 +14,7 @@
"dependencies": {
"@capacitor/android": "^5.6.0",
"@capacitor/core": "^5.6.0",
"@capacitor/preferences": "^5.0.7",
"@capacitor/http": "^5.0.7"
"@capacitor/preferences": "^5.0.7"
},
"devDependencies": {
"@capacitor/cli": "^5.6.0",