commit e60c71085ccf6b3c7930d6fdd1c19b2076bb877d
parent 23598e0e62ee25dc5cef4212e162e77c3eab4256
Author: Luxferre <lux@ferre>
Date: Mon, 3 Apr 2023 15:24:05 +0300
basic gopher:// url view activity handling
Diffstat:
2 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/js/app.js b/js/app.js
@@ -338,8 +338,17 @@ addEventListener('DOMContentLoaded', function() {
//setup the theme
updateTheme()
- // load the homepage if present
- var hp = getBookmark(0)
- loadURL(hp || 'about:kopher')
+ // load the homepage if present and we're not in an activity
+ if(!location.hash) {
+ var hp = getBookmark(0)
+ loadURL(hp || 'about:kopher')
+ }
+
+ // set external activity handling for gopher:// URLs
+ navigator.mozSetMessageHandler('activity', function(req) {
+ var act = req.source
+ if(act.name === 'view' && act.data.type === 'url' && act.data.url)
+ loadURL((''+act.data.url) || 'about:kopher')
+ });
}, false)
diff --git a/manifest.webapp b/manifest.webapp
@@ -1,5 +1,5 @@
{
- "version": "0.0.5",
+ "version": "0.0.6",
"name": "Kopher",
"description": "A Gopher client for KaiOS",
"launch_path": "/index.html",
@@ -24,6 +24,20 @@
"description": "To notify about downloaded files"
}
},
+ "activities": {
+ "view": {
+ "href": "/index.html#ext",
+ "disposition": "window",
+ "filters": {
+ "type": "url",
+ "url": {
+ "required": true,
+ "pattern":"gopher:.{1,16384}"
+ }
+ },
+ "returnValue": false
+ }
+ },
"installs_allowed_from": [
"*"
],