Skip to content

Commit

Permalink
Add ability to install theme as desktop app 1/2
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Aug 19, 2021
1 parent 8349ff4 commit 40a9dec
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 20 deletions.
11 changes: 8 additions & 3 deletions authentic-init.pl
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ sub embed_favicon
print ' <link ' .
$ref_link . ' rel="icon" type="image/png" sizes="16x16" href="' . $favicon_path . '/favicon-16x16.png">' . "\n";

print ' <link ' .
$ref_link . ' crossorigin="use-credentials" rel="manifest" href="' . $favicon_path . '/manifest.json">' . "\n";
print ' <link ' . $ref_link . ' crossorigin="use-credentials" rel="manifest" href="' .
$theme_webprefix . '/manifest-' . $product . '.json">' . "\n";
print ' <link ' . $ref_link .
' rel="mask-icon" href="' . $favicon_path . '/safari-pinned-tab.svg" color="' . get_theme_color() . '">' . "\n";
print ' <meta ' .
$ref_link . ' name="msapplication-TileImage" content="' . $favicon_path . '/mstile-144x144.png">' . "\n";
$ref_link . ' name="msapplication-TileImage" content="' . $favicon_path . '/mstile-150x150.png">' . "\n";
}

# Embed custom favicons using base64 encoding
Expand All @@ -137,9 +137,14 @@ sub embed_favicon
trim_lines(trim(encode_base64(read_file_contents($favicon_spath . '/android-chrome-192x192.png')))) . '">' . "\n";
print ' <link ' . $ref_link . ' rel="icon" type="image/png" sizes="16x16" href="data:text/css;base64,' .
trim_lines(trim(encode_base64(read_file_contents($favicon_spath . '/favicon-16x16.png')))) . '">' . "\n";
if (-r "$favicon_cpath/manifest.json") {
print ' <link ' . $ref_link . ' crossorigin="use-credentials" rel="manifest" href="' .
$theme_webprefix . '/manifest-c-' . $product . '.json">' . "\n";
}
}
print ' <meta name="msapplication-TileColor" content="' . get_theme_color() . '">' . "\n";
print ' <meta name="theme-color" content="' . get_theme_color() . '">' . "\n";
print ' <script src="' . $theme_webprefix . '/service-worker.js" defer></script>' . "\n";
}

sub embed_header
Expand Down
8 changes: 4 additions & 4 deletions images/favicons/cloudmin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
"scope": ".",
"icons": [
{
"src": "/images/favicons/cloudmin/android-chrome-192x192.png",
"src": "images/favicons/cloudmin/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/cloudmin/android-chrome-maskable-192x192.png",
"src": "images/favicons/cloudmin/android-chrome-maskable-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/images/favicons/cloudmin/android-chrome-512x512.png",
"src": "images/favicons/cloudmin/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/cloudmin/android-chrome-maskable-512x512.png",
"src": "images/favicons/cloudmin/android-chrome-maskable-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
Expand Down
8 changes: 4 additions & 4 deletions images/favicons/usermin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
"scope": ".",
"icons": [
{
"src": "/images/favicons/usermin/android-chrome-192x192.png",
"src": "images/favicons/usermin/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/usermin/android-chrome-maskable-192x192.png",
"src": "images/favicons/usermin/android-chrome-maskable-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/images/favicons/usermin/android-chrome-512x512.png",
"src": "images/favicons/usermin/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/usermin/android-chrome-maskable-512x512.png",
"src": "images/favicons/usermin/android-chrome-maskable-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
Expand Down
8 changes: 4 additions & 4 deletions images/favicons/virtualmin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
"scope": ".",
"icons": [
{
"src": "/images/favicons/virtualmin/android-chrome-192x192.png",
"src": "images/favicons/virtualmin/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/virtualmin/android-chrome-maskable-192x192.png",
"src": "images/favicons/virtualmin/android-chrome-maskable-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/images/favicons/virtualmin/android-chrome-512x512.png",
"src": "images/favicons/virtualmin/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/virtualmin/android-chrome-maskable-512x512.png",
"src": "images/favicons/virtualmin/android-chrome-maskable-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
Expand Down
8 changes: 4 additions & 4 deletions images/favicons/webmin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
"scope": ".",
"icons": [
{
"src": "/images/favicons/webmin/android-chrome-192x192.png",
"src": "images/favicons/webmin/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/webmin/android-chrome-maskable-192x192.png",
"src": "images/favicons/webmin/android-chrome-maskable-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/images/favicons/webmin/android-chrome-512x512.png",
"src": "images/favicons/webmin/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/images/favicons/webmin/android-chrome-maskable-512x512.png",
"src": "images/favicons/webmin/android-chrome-maskable-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
Expand Down
1 change: 1 addition & 0 deletions manifest-c-cloudmin.json
1 change: 1 addition & 0 deletions manifest-c-usermin.json
1 change: 1 addition & 0 deletions manifest-c-virtualmin.json
1 change: 1 addition & 0 deletions manifest-c-webmin.json
1 change: 1 addition & 0 deletions manifest-cloudmin.json
1 change: 1 addition & 0 deletions manifest-usermin.json
1 change: 1 addition & 0 deletions manifest-virtualmin.json
1 change: 1 addition & 0 deletions manifest-webmin.json
1 change: 1 addition & 0 deletions service-worker.js
2 changes: 1 addition & 1 deletion theme.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
desc=Authentic Theme
longdesc=Webmin/Usermin/Virtualmin/Cloudmin theme based on Bootstrap and Font Awesome (https://github.com/authentic-theme/authentic-theme)
version=19.83-RC5
mversion=00
mversion=01
depends=1.974 1.824
webmin=1
usermin=1
4 changes: 4 additions & 0 deletions unauthenticated/js/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
}
self.addEventListener('fetch', function() {});

0 comments on commit 40a9dec

Please sign in to comment.