aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ServiceWorker.js10
-rw-r--r--Zotlabs/Module/Manifest.php52
-rw-r--r--Zotlabs/Module/Rpost.php67
-rw-r--r--boot.php4
-rw-r--r--images/app/hz-120.pngbin0 -> 5552 bytes
-rw-r--r--images/app/hz-128.pngbin0 -> 5885 bytes
-rw-r--r--images/app/hz-144.pngbin0 -> 6692 bytes
-rw-r--r--images/app/hz-152.pngbin0 -> 7050 bytes
-rw-r--r--images/app/hz-180.pngbin0 -> 8522 bytes
-rw-r--r--images/app/hz-192.pngbin0 -> 9058 bytes
-rw-r--r--images/app/hz-384.pngbin0 -> 19032 bytes
-rw-r--r--images/app/hz-512.pngbin0 -> 26021 bytes
-rw-r--r--images/app/hz-72.pngbin0 -> 3332 bytes
-rw-r--r--images/app/hz-96.pngbin0 -> 4430 bytes
-rw-r--r--images/app/hz.svg112
-rw-r--r--view/js/main.js9
16 files changed, 254 insertions, 0 deletions
diff --git a/ServiceWorker.js b/ServiceWorker.js
new file mode 100644
index 000000000..1b84fdfb7
--- /dev/null
+++ b/ServiceWorker.js
@@ -0,0 +1,10 @@
+// This file should be served from the web root to avoid scope and cookie related issues with some browsers
+self.addEventListener('install', function(e) {
+ console.log('install event');
+});
+
+self.addEventListener('fetch', function(e) {
+ // nothing here yet
+ return;
+});
+
diff --git a/Zotlabs/Module/Manifest.php b/Zotlabs/Module/Manifest.php
new file mode 100644
index 000000000..5297245d3
--- /dev/null
+++ b/Zotlabs/Module/Manifest.php
@@ -0,0 +1,52 @@
+<?php
+namespace Zotlabs\Module;
+
+use App;
+use Zotlabs\Web\Controller;
+use Zotlabs\Lib\System;
+
+class Manifest extends Controller {
+
+ function init() {
+
+ $ret = [
+ 'name' => ucfirst(System::get_platform_name()),
+ 'short_name' => ucfirst(System::get_platform_name()),
+ 'icons' => [
+ [ 'src' => '/images/app/hz-72.png', 'sizes' => '72x72', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz-96.png', 'sizes' => '96x96', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz-128.png', 'sizes' => '128x128', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz-144.png', 'sizes' => '144x144', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz-152.png', 'sizes' => '152x152', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz-192.png', 'sizes' => '192x192', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz-348.png', 'sizes' => '384x384', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz-512.png', 'sizes' => '512x512', 'type' => 'image/png' ],
+ [ 'src' => '/images/app/hz.svg', 'sizes' => '64x64', 'type' => 'image/xml+svg' ]
+ ],
+ 'scope' => '/',
+ 'start_url' => z_root(),
+ 'display' => 'standalone',
+ 'orientation' => 'any',
+ 'theme_color' => '#343a40',
+ 'background_color' => 'white',
+ 'share_target' => [
+ 'action' => '/rpost',
+ 'method' => 'POST',
+ 'enctype' => 'multipart/form-data',
+ 'params' => [
+ 'title' => 'title',
+ 'text' => 'body',
+ 'url' => 'url',
+ 'files' => [
+ [ 'name' => 'userfile',
+ 'accept' => [ 'image/*', 'audio/*', 'video/*', 'text/*', 'application/*' ]
+ ]
+ ]
+ ]
+ ]
+ ];
+
+ json_return_and_die($ret,'application/manifest+json');
+ }
+
+}
diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php
index 80ad289b2..013817597 100644
--- a/Zotlabs/Module/Rpost.php
+++ b/Zotlabs/Module/Rpost.php
@@ -66,6 +66,73 @@ class Rpost extends \Zotlabs\Web\Controller {
nav_set_selected('Post');
+ if (local_channel() && array_key_exists('userfile',$_FILES)) {
+
+ $channel = App::get_channel();
+ $observer = App::get_observer();
+
+ $def_album = get_pconfig($channel['channel_id'],'system','photo_path');
+ $def_attach = get_pconfig($channel['channel_id'],'system','attach_path');
+
+ $r = attach_store($channel, (($observer) ? $observer['xchan_hash'] : ''), '', [
+ 'source' => 'editor',
+ 'visible' => 0,
+ 'album' => $def_album,
+ 'directory' => $def_attach,
+ 'flags' => 1, // indicates temporary permissions are created
+ 'allow_cid' => '<' . $channel['channel_hash'] . '>'
+ ]);
+
+ if (! $r['success']) {
+ notice( $r['message'] . EOL);
+ }
+
+ $s = EMPTY_STR;
+
+ if (intval($r['data']['is_photo'])) {
+ $s .= "\n\n" . $r['body'] . "\n\n";
+ }
+
+ $url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
+
+ if (strpos($r['data']['filetype'],'video') === 0) {
+ $s .= "\n\n" . '[zvideo]' . $url . '[/zvideo]' . "\n\n";
+ }
+
+ if (strpos($r['data']['filetype'],'audio') === 0) {
+ $s .= "\n\n" . '[zaudio]' . $url . '[/zaudio]' . "\n\n";
+ }
+
+ if ($r['data']['filetype'] === 'image/svg+xml') {
+ $x = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
+ if ($x) {
+ $bb = svg2bb($x);
+ if ($bb) {
+ $s .= "\n\n" . $bb;
+ }
+ else {
+ logger('empty return from svgbb');
+ }
+ }
+ else {
+ logger('unable to read svg data file: ' . 'store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
+ }
+ }
+
+ if ($r['data']['filetype'] === 'text/calendar') {
+ $content = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
+ if ($content) {
+ $ev = ical_to_ev($content);
+ if ($ev) {
+ $s .= "\n\n" . format_event_bbcode($ev[0]) . "\n\n";
+ }
+ }
+ }
+
+ $s .= "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n";
+ $_REQUEST['body'] = ((array_key_exists('body',$_REQUEST)) ? $_REQUEST['body'] . $s : $s);
+ }
+
// If we have saved rpost session variables, but nothing in the current $_REQUEST, recover the saved variables
if((! array_key_exists('body',$_REQUEST)) && (array_key_exists('rpost',$_SESSION))) {
diff --git a/boot.php b/boot.php
index ab23365c4..c2d08f87a 100644
--- a/boot.php
+++ b/boot.php
@@ -1198,6 +1198,10 @@ class App {
}
}
+ // webmanifest
+ head_add_link(['rel' => 'manifest', 'href' => '/manifest.json']);
+ self::$meta->set('application-name', Zotlabs\Lib\System::get_platform_name());
+
self::$meta->set('generator', Zotlabs\Lib\System::get_platform_name());
head_add_link(['rel' => 'shortcut icon', 'href' => head_get_icon()]);
diff --git a/images/app/hz-120.png b/images/app/hz-120.png
new file mode 100644
index 000000000..a9acf1f17
--- /dev/null
+++ b/images/app/hz-120.png
Binary files differ
diff --git a/images/app/hz-128.png b/images/app/hz-128.png
new file mode 100644
index 000000000..327d1cc27
--- /dev/null
+++ b/images/app/hz-128.png
Binary files differ
diff --git a/images/app/hz-144.png b/images/app/hz-144.png
new file mode 100644
index 000000000..58b9b205a
--- /dev/null
+++ b/images/app/hz-144.png
Binary files differ
diff --git a/images/app/hz-152.png b/images/app/hz-152.png
new file mode 100644
index 000000000..bdd9e81c4
--- /dev/null
+++ b/images/app/hz-152.png
Binary files differ
diff --git a/images/app/hz-180.png b/images/app/hz-180.png
new file mode 100644
index 000000000..f43d39af1
--- /dev/null
+++ b/images/app/hz-180.png
Binary files differ
diff --git a/images/app/hz-192.png b/images/app/hz-192.png
new file mode 100644
index 000000000..e10aa6502
--- /dev/null
+++ b/images/app/hz-192.png
Binary files differ
diff --git a/images/app/hz-384.png b/images/app/hz-384.png
new file mode 100644
index 000000000..687500cee
--- /dev/null
+++ b/images/app/hz-384.png
Binary files differ
diff --git a/images/app/hz-512.png b/images/app/hz-512.png
new file mode 100644
index 000000000..86206a0da
--- /dev/null
+++ b/images/app/hz-512.png
Binary files differ
diff --git a/images/app/hz-72.png b/images/app/hz-72.png
new file mode 100644
index 000000000..52e3baf76
--- /dev/null
+++ b/images/app/hz-72.png
Binary files differ
diff --git a/images/app/hz-96.png b/images/app/hz-96.png
new file mode 100644
index 000000000..f2590eedc
--- /dev/null
+++ b/images/app/hz-96.png
Binary files differ
diff --git a/images/app/hz.svg b/images/app/hz.svg
new file mode 100644
index 000000000..61ca9e1d4
--- /dev/null
+++ b/images/app/hz.svg
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ width="64.0px"
+ height="64.0px"
+ viewBox="0 0 64.0 64.0"
+ version="1.1"
+ id="SVGRoot"
+ sodipodi:docname="hz.svg"
+ inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview61"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:document-units="px"
+ showgrid="true"
+ inkscape:zoom="6.0069951"
+ inkscape:cx="16.980204"
+ inkscape:cy="24.970888"
+ inkscape:window-width="1440"
+ inkscape:window-height="831"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g141">
+ <inkscape:grid
+ type="xygrid"
+ id="grid67" />
+ </sodipodi:namedview>
+ <defs
+ id="defs56" />
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g141"
+ transform="matrix(3.7795276,0,0,3.7795276,22.748366,-1063.1931)">
+ <circle
+ style="fill:#43488a;stroke-width:0.264583;stop-color:#000000;fill-opacity:1"
+ id="path3823"
+ cx="2.4478281"
+ cy="289.76984"
+ r="8.4666662"
+ inkscape:export-filename="/run/user/1000/gvfs/sftp:host=10.3.0.14,user=root/srv/http/hub.somaton.com/www/images/app/hz-180.png"
+ inkscape:export-xdpi="270.00003"
+ inkscape:export-ydpi="270.00003" />
+ <g
+ id="g141-7"
+ transform="matrix(2.1038824,0,0,2.1655785,0.49257199,-333.55376)"
+ style="fill:#ffffff;stroke-width:0.468493;fill-opacity:1"
+ inkscape:export-filename="/run/user/1000/gvfs/sftp:host=10.3.0.14,user=root/srv/http/hub.somaton.com/www/images/app/hz-144.png"
+ inkscape:export-xdpi="276.47998"
+ inkscape:export-ydpi="276.47998">
+ <g
+ id="g2037"
+ inkscape:export-filename="/home/mario/Downloads/hz-icons/hz-512.png"
+ inkscape:export-xdpi="983.03998"
+ inkscape:export-ydpi="983.03998"
+ style="fill:#ffffff;stroke-width:0.468493;fill-opacity:1"
+ transform="translate(-4.3232614,-4.7489871)">
+ <ellipse
+ ry="1.0883039"
+ rx="1.0802424"
+ cy="292.92801"
+ cx="3.5032701"
+ id="path828-53"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.0235165" />
+ <ellipse
+ ry="1.5397485"
+ rx="1.4994409"
+ cy="291.37213"
+ cx="6.5827665"
+ id="path828-5"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.0329556" />
+ <ellipse
+ ry="0.78196651"
+ rx="0.79002792"
+ cy="294.54837"
+ cx="5.9217243"
+ id="path828-5-6"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.0170471" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0"
+ id="path871"
+ d="m 4.0465627,292.41576 1.3137706,-0.7355 0.1162183,0.24151 -1.2935591,0.74648 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.0276335px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path873"
+ d="m 4.2605136,293.26434 1.2691295,0.89108 -0.141557,0.20603 -1.2642478,-0.86532 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.02631px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path875"
+ d="m 5.8411078,293.86314 0.361292,-1.12861 0.2956026,0.0605 -0.3886627,1.11652 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.0246474px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ </g>
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/view/js/main.js b/view/js/main.js
index 68f3415ee..d121913ea 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -34,6 +34,7 @@ if(localStorage.getItem('uid') !== localUser.toString()) {
sessionStorage.clear();
localStorage.setItem('uid', localUser.toString());
}
+
window.onstorage = function(e) {
if(e.key === 'uid' && parseInt(e.newValue) !== localUser) {
if(window_needs_alert) {
@@ -45,6 +46,14 @@ window.onstorage = function(e) {
}
}
+if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('/ServiceWorker.js', { scope: '/' }).then(function(registration) {
+ console.log('Service worker registered. scope is', registration.scope);
+ }).catch(function(error) {
+ console.log('Service worker registration failed because ' + error);
+ });
+}
+
$.ajaxSetup({cache: false});
$(document).ready(function() {