Merge pull request #3822 from flaparoo/android-http-timeout

android: pass HTTP request timeout to Gadgetbridge
master
Gordon Williams 2025-04-24 14:59:04 +01:00 committed by GitHub
commit b63c819a0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View File

@ -46,3 +46,4 @@
arrival. (Needs Gadgetbridge nightly (either flavour) for now, or stable arrival. (Needs Gadgetbridge nightly (either flavour) for now, or stable
version 85 when it's out) version 85 when it's out)
0.43: Ensure listRecs doesn't list old-style recorded tracks (Otherwise Gadgetbridge fails parsing the filename) 0.43: Ensure listRecs doesn't list old-style recorded tracks (Otherwise Gadgetbridge fails parsing the filename)
0.44: Pass HTTP request timeout to Gadgetbridge

View File

@ -321,6 +321,7 @@ exports.httpHandler = (url,options) => {
if (options.method) req.method = options.method; if (options.method) req.method = options.method;
if (options.body) req.body = options.body; if (options.body) req.body = options.body;
if (options.headers) req.headers = options.headers; if (options.headers) req.headers = options.headers;
req.timeout = options.timeout || 30000;
exports.gbSend(req); exports.gbSend(req);
//create the promise //create the promise
var promise = new Promise(function(resolve,reject) { var promise = new Promise(function(resolve,reject) {
@ -329,7 +330,7 @@ exports.httpHandler = (url,options) => {
//if after "timeoutMillisec" it still hasn't answered -> reject //if after "timeoutMillisec" it still hasn't answered -> reject
delete Bangle.httpRequest[options.id]; delete Bangle.httpRequest[options.id];
reject("Timeout"); reject("Timeout");
},options.timeout||30000)}; },req.timeout+500)};
}); });
return promise; return promise;
}; };

View File

@ -2,7 +2,7 @@
"id": "android", "id": "android",
"name": "Android Integration", "name": "Android Integration",
"shortName": "Android", "shortName": "Android",
"version": "0.43", "version": "0.44",
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.", "description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
"icon": "app.png", "icon": "app.png",
"tags": "tool,system,messages,notifications,gadgetbridge", "tags": "tool,system,messages,notifications,gadgetbridge",