diff --git a/internal/view/assets/js/page/home.js b/internal/view/assets/js/page/home.js
index 9d703df8..2a09a868 100644
--- a/internal/view/assets/js/page/home.js
+++ b/internal/view/assets/js/page/home.js
@@ -373,7 +373,11 @@ export default {
this.page = 1;
this.loadData();
},
- showDialogAdd() {
+ showDialogAdd(values) {
+ if (values === undefined) {
+ values = {};
+ }
+
this.showDialog({
title: "New Bookmark",
content: "Create a new bookmark",
@@ -381,15 +385,18 @@ export default {
{
name: "url",
label: "Url, start with http://...",
+ value: values.url || "",
},
{
name: "title",
label: "Custom title (optional)",
+ value: values.title || "",
},
{
name: "excerpt",
label: "Custom excerpt (optional)",
type: "area",
+ value: values.excerpt || "",
},
{
name: "tags",
@@ -1034,6 +1041,36 @@ export default {
this.search = url.query.search || "";
this.page = url.query.page || 1;
+ var isSharing =
+ url.query.url !== undefined || url.query.excerpt !== undefined;
+ if (isSharing) {
+ // this is what the spec says
+ var shareData = {
+ url: url.query.url,
+ excerpt: url.query.excerpt,
+ title: url.query.title,
+ };
+
+ // In my testing sharing from chrome and ff focus, this is how data arrives
+ if (shareData.url === undefined) {
+ shareData.url = url.query.excerpt;
+ shareData.title = url.query.title;
+ shareData.excerpt = "";
+ }
+
+ this.showDialogAdd(shareData);
+ var history = {
+ activePage: "page-home",
+ search: this.search,
+ page: this.page,
+ };
+
+ var url = new Url(document.baseURI);
+ url.hash = "home";
+ url.clearQuery();
+ window.history.replaceState(history, "page-home", url);
+ }
+
this.loadData(false, true);
},
};
diff --git a/internal/view/assets/manifest.webmanifest b/internal/view/assets/manifest.webmanifest
new file mode 100644
index 00000000..ff0526f5
--- /dev/null
+++ b/internal/view/assets/manifest.webmanifest
@@ -0,0 +1,48 @@
+{
+ "name": "Shiori",
+ "short_name": "Shiori",
+ "display": "standalone",
+ "description": "Shiori is a simple bookmarks manager written in the Go language. Intended as a simple clone of Pocket. You can use it as a command line application or as a web application. This application is distributed as a single binary, which means it can be installed and used easily.",
+ "icons": [
+ {
+ "src": "res/apple-touch-icon-144x144.png",
+ "type": "image/png",
+ "sizes": "144x144"
+ },
+ {
+ "src": "res/apple-touch-icon-152x152.png",
+ "type": "image/png",
+ "sizes": "152x152",
+ "purpose": "maskable"
+ },
+ {
+ "src": "res/pwa-192x192.png",
+ "type": "image/png",
+ "sizes": "192x192",
+ "purpose": "maskable"
+ },
+ {
+ "src": "res/pwa-512x512.png",
+ "type": "image/png",
+ "sizes": "512x512",
+ "purpose": "maskable"
+ },
+ {
+ "src": "res/pwa-1024x1024.png",
+ "type": "image/png",
+ "sizes": "1024x1024",
+ "purpose": "maskable"
+ }
+ ],
+ "start_url": "../",
+ "share_target": {
+ "action": "../",
+ "enctype": "application/x-www-form-urlencoded",
+ "method": "GET",
+ "params": {
+ "title": "title",
+ "text": "excerpt",
+ "url": "url"
+ }
+ }
+}
diff --git a/internal/view/assets/res/pwa-1024x1024.png b/internal/view/assets/res/pwa-1024x1024.png
new file mode 100644
index 00000000..2bfc768a
Binary files /dev/null and b/internal/view/assets/res/pwa-1024x1024.png differ
diff --git a/internal/view/assets/res/pwa-192x192.png b/internal/view/assets/res/pwa-192x192.png
new file mode 100644
index 00000000..5c2c5b00
Binary files /dev/null and b/internal/view/assets/res/pwa-192x192.png differ
diff --git a/internal/view/assets/res/pwa-512x512.png b/internal/view/assets/res/pwa-512x512.png
new file mode 100644
index 00000000..1e86d6e3
Binary files /dev/null and b/internal/view/assets/res/pwa-512x512.png differ
diff --git a/internal/view/content.html b/internal/view/content.html
index 73b33a49..e43ef5d8 100644
--- a/internal/view/content.html
+++ b/internal/view/content.html
@@ -13,6 +13,7 @@
+
diff --git a/internal/view/embed.go b/internal/view/embed.go
index 1b5e99a6..ffb63043 100644
--- a/internal/view/embed.go
+++ b/internal/view/embed.go
@@ -2,7 +2,7 @@ package views
import "embed"
-//go:embed assets/js/* assets/css/* assets/res/*
+//go:embed assets/js/* assets/css/* assets/res/* assets/manifest.webmanifest
var Assets embed.FS
//go:embed *.html
diff --git a/internal/view/index.html b/internal/view/index.html
index aba8a7ff..89d7584e 100644
--- a/internal/view/index.html
+++ b/internal/view/index.html
@@ -13,6 +13,7 @@
+