diff --git a/.gitignore b/.gitignore index 4f5c8df..8ac51c1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /node_modules /public/assets /public/index.html +/public/mami.webmanifest diff --git a/build.js b/build.js index af443dc..cd7c1ef 100644 --- a/build.js +++ b/build.js @@ -31,6 +31,9 @@ const buildTasks = { html: [ { source: 'mami.html', target: '/', name: 'index.html', }, ], + webmanifest: [ + { source: 'mami.webmanifest', target: '/', name: 'mami.webmanifest', icons: '/icons' } + ], }; @@ -188,6 +191,79 @@ const htmlMinifyOptions = { } + console.log(); + console.log('Webmanifest assets...'); + for(const info of buildTasks.webmanifest) { + console.log(`=> Building ${info.source}...`); + + try { + const body = JSON.parse(fs.readFileSync(path.join(srcDir, info.source))); + + body.name = config.title; + body.short_name = config.title; + + if(typeof info.icons === 'string') { + const iconsDir = path.join(pubDir, info.icons); + + if(fs.existsSync(iconsDir)) { + const files = (await fs.promises.readdir(iconsDir)).sort((a, b) => a.localeCompare(b, undefined, { + numeric: true, + sensitivity: 'base', + })); + body.icons = []; + + for(const file of files) { + if(!file.endsWith('.png')) + continue; + + const icon = { + src: path.join(info.icons, file), + type: 'image/png', + }; + + if(file[0] !== 'c') { + if(file[0] === 'm') + icon.purpose = 'maskable'; + else if(file[0] === 'w') + icon.purpose = 'monochrome'; + else continue; + } + + let res = ''; + for(let i = 1; i < file.length; ++i) { + if(file[i] === 'x') + break; + res += file[i]; + } + + if(res.length > 0) + icon.sizes = `${res}x${res}`; + + body.icons.push(icon); + } + } + } + + const data = JSON.stringify(body); + + const name = utils.strtr(info.name, { hash: utils.shortHash(data) }); + const pubName = path.join(info.target || '', name); + + console.log(` Saving to ${pubName}...`); + + const fullPath = path.join(pubDir, pubName); + const dirPath = path.dirname(fullPath); + if(!fs.existsSync(dirPath)) + fs.mkdirSync(dirPath, { recursive: true }); + + fs.writeFileSync(fullPath, data); + htmlVars[info.source] = pubName; + } catch(err) { + console.error(err); + } + } + + console.log(); console.log('HTML assets'); for(const info of buildTasks.html) { @@ -219,6 +295,7 @@ const htmlMinifyOptions = { } } + console.log(); console.log('Cleaning up old builds...'); assproc.housekeep(pubAssetsDir); diff --git a/public/icons/128x.png b/public/icons/128x.png deleted file mode 100644 index 89c8d82..0000000 Binary files a/public/icons/128x.png and /dev/null differ diff --git a/public/icons/16x.png b/public/icons/16x.png deleted file mode 100644 index 02755b3..0000000 Binary files a/public/icons/16x.png and /dev/null differ diff --git a/public/icons/256x.png b/public/icons/256x.png deleted file mode 100644 index 0a07b3a..0000000 Binary files a/public/icons/256x.png and /dev/null differ diff --git a/public/icons/32x.png b/public/icons/32x.png deleted file mode 100644 index 18f71bd..0000000 Binary files a/public/icons/32x.png and /dev/null differ diff --git a/public/icons/48x.png b/public/icons/48x.png deleted file mode 100644 index acfdb63..0000000 Binary files a/public/icons/48x.png and /dev/null differ diff --git a/public/icons/512x.png b/public/icons/512x.png deleted file mode 100644 index 7f1c5b9..0000000 Binary files a/public/icons/512x.png and /dev/null differ diff --git a/public/icons/64x.png b/public/icons/64x.png deleted file mode 100644 index 6c69ebe..0000000 Binary files a/public/icons/64x.png and /dev/null differ diff --git a/public/icons/90x.png b/public/icons/90x.png deleted file mode 100644 index 498f535..0000000 Binary files a/public/icons/90x.png and /dev/null differ diff --git a/public/icons/c114x.png b/public/icons/c114x.png new file mode 100644 index 0000000..58183e9 Binary files /dev/null and b/public/icons/c114x.png differ diff --git a/public/icons/c120x.png b/public/icons/c120x.png new file mode 100644 index 0000000..d881e94 Binary files /dev/null and b/public/icons/c120x.png differ diff --git a/public/icons/c128x.png b/public/icons/c128x.png new file mode 100644 index 0000000..e94f0bd Binary files /dev/null and b/public/icons/c128x.png differ diff --git a/public/icons/c144x.png b/public/icons/c144x.png new file mode 100644 index 0000000..c4adcd6 Binary files /dev/null and b/public/icons/c144x.png differ diff --git a/public/icons/c152x.png b/public/icons/c152x.png new file mode 100644 index 0000000..4f0c4fe Binary files /dev/null and b/public/icons/c152x.png differ diff --git a/public/icons/c167x.png b/public/icons/c167x.png new file mode 100644 index 0000000..c009d06 Binary files /dev/null and b/public/icons/c167x.png differ diff --git a/public/icons/c180x.png b/public/icons/c180x.png new file mode 100644 index 0000000..c7fc8e4 Binary files /dev/null and b/public/icons/c180x.png differ diff --git a/public/icons/c192x.png b/public/icons/c192x.png new file mode 100644 index 0000000..86cd2f0 Binary files /dev/null and b/public/icons/c192x.png differ diff --git a/public/icons/c256x.png b/public/icons/c256x.png new file mode 100644 index 0000000..dc74524 Binary files /dev/null and b/public/icons/c256x.png differ diff --git a/public/icons/c384x.png b/public/icons/c384x.png new file mode 100644 index 0000000..895b09a Binary files /dev/null and b/public/icons/c384x.png differ diff --git a/public/icons/c48x.png b/public/icons/c48x.png new file mode 100644 index 0000000..d730f66 Binary files /dev/null and b/public/icons/c48x.png differ diff --git a/public/icons/c512x.png b/public/icons/c512x.png new file mode 100644 index 0000000..5239654 Binary files /dev/null and b/public/icons/c512x.png differ diff --git a/public/icons/c57x.png b/public/icons/c57x.png new file mode 100644 index 0000000..78492a0 Binary files /dev/null and b/public/icons/c57x.png differ diff --git a/public/icons/c60x.png b/public/icons/c60x.png new file mode 100644 index 0000000..280087d Binary files /dev/null and b/public/icons/c60x.png differ diff --git a/public/icons/c64x.png b/public/icons/c64x.png new file mode 100644 index 0000000..856d8de Binary files /dev/null and b/public/icons/c64x.png differ diff --git a/public/icons/c72x.png b/public/icons/c72x.png new file mode 100644 index 0000000..0ba608f Binary files /dev/null and b/public/icons/c72x.png differ diff --git a/public/icons/c76x.png b/public/icons/c76x.png new file mode 100644 index 0000000..f341874 Binary files /dev/null and b/public/icons/c76x.png differ diff --git a/public/icons/c96x.png b/public/icons/c96x.png new file mode 100644 index 0000000..477dc3b Binary files /dev/null and b/public/icons/c96x.png differ diff --git a/public/icons/m114x.png b/public/icons/m114x.png new file mode 100644 index 0000000..bb9f1e6 Binary files /dev/null and b/public/icons/m114x.png differ diff --git a/public/icons/m120x.png b/public/icons/m120x.png new file mode 100644 index 0000000..b7f7c3a Binary files /dev/null and b/public/icons/m120x.png differ diff --git a/public/icons/m128x.png b/public/icons/m128x.png new file mode 100644 index 0000000..abe3eb5 Binary files /dev/null and b/public/icons/m128x.png differ diff --git a/public/icons/m144x.png b/public/icons/m144x.png new file mode 100644 index 0000000..8bda468 Binary files /dev/null and b/public/icons/m144x.png differ diff --git a/public/icons/m152x.png b/public/icons/m152x.png new file mode 100644 index 0000000..9347630 Binary files /dev/null and b/public/icons/m152x.png differ diff --git a/public/icons/m167x.png b/public/icons/m167x.png new file mode 100644 index 0000000..a58760e Binary files /dev/null and b/public/icons/m167x.png differ diff --git a/public/icons/m180x.png b/public/icons/m180x.png new file mode 100644 index 0000000..909c6ee Binary files /dev/null and b/public/icons/m180x.png differ diff --git a/public/icons/m192x.png b/public/icons/m192x.png new file mode 100644 index 0000000..ec61ef5 Binary files /dev/null and b/public/icons/m192x.png differ diff --git a/public/icons/m256x.png b/public/icons/m256x.png new file mode 100644 index 0000000..f1de46e Binary files /dev/null and b/public/icons/m256x.png differ diff --git a/public/icons/m384x.png b/public/icons/m384x.png new file mode 100644 index 0000000..b527346 Binary files /dev/null and b/public/icons/m384x.png differ diff --git a/public/icons/m48x.png b/public/icons/m48x.png new file mode 100644 index 0000000..0d2bf32 Binary files /dev/null and b/public/icons/m48x.png differ diff --git a/public/icons/m512x.png b/public/icons/m512x.png new file mode 100644 index 0000000..1c00892 Binary files /dev/null and b/public/icons/m512x.png differ diff --git a/public/icons/m57x.png b/public/icons/m57x.png new file mode 100644 index 0000000..9a157a6 Binary files /dev/null and b/public/icons/m57x.png differ diff --git a/public/icons/m60x.png b/public/icons/m60x.png new file mode 100644 index 0000000..b9f2c43 Binary files /dev/null and b/public/icons/m60x.png differ diff --git a/public/icons/m64x.png b/public/icons/m64x.png new file mode 100644 index 0000000..d03ea60 Binary files /dev/null and b/public/icons/m64x.png differ diff --git a/public/icons/m72x.png b/public/icons/m72x.png new file mode 100644 index 0000000..d0528b3 Binary files /dev/null and b/public/icons/m72x.png differ diff --git a/public/icons/m76x.png b/public/icons/m76x.png new file mode 100644 index 0000000..50d8c99 Binary files /dev/null and b/public/icons/m76x.png differ diff --git a/public/icons/m96x.png b/public/icons/m96x.png new file mode 100644 index 0000000..e01b3d8 Binary files /dev/null and b/public/icons/m96x.png differ diff --git a/public/icons/w114x.png b/public/icons/w114x.png new file mode 100644 index 0000000..2cb1f16 Binary files /dev/null and b/public/icons/w114x.png differ diff --git a/public/icons/w120x.png b/public/icons/w120x.png new file mode 100644 index 0000000..c67825f Binary files /dev/null and b/public/icons/w120x.png differ diff --git a/public/icons/w128x.png b/public/icons/w128x.png new file mode 100644 index 0000000..fe546ad Binary files /dev/null and b/public/icons/w128x.png differ diff --git a/public/icons/w144x.png b/public/icons/w144x.png new file mode 100644 index 0000000..8386508 Binary files /dev/null and b/public/icons/w144x.png differ diff --git a/public/icons/w152x.png b/public/icons/w152x.png new file mode 100644 index 0000000..26a90c7 Binary files /dev/null and b/public/icons/w152x.png differ diff --git a/public/icons/w167x.png b/public/icons/w167x.png new file mode 100644 index 0000000..de2432a Binary files /dev/null and b/public/icons/w167x.png differ diff --git a/public/icons/w180x.png b/public/icons/w180x.png new file mode 100644 index 0000000..e8797f3 Binary files /dev/null and b/public/icons/w180x.png differ diff --git a/public/icons/w192x.png b/public/icons/w192x.png new file mode 100644 index 0000000..c7b4849 Binary files /dev/null and b/public/icons/w192x.png differ diff --git a/public/icons/w256x.png b/public/icons/w256x.png new file mode 100644 index 0000000..5ca0a43 Binary files /dev/null and b/public/icons/w256x.png differ diff --git a/public/icons/w384x.png b/public/icons/w384x.png new file mode 100644 index 0000000..135efce Binary files /dev/null and b/public/icons/w384x.png differ diff --git a/public/icons/w48x.png b/public/icons/w48x.png new file mode 100644 index 0000000..809d832 Binary files /dev/null and b/public/icons/w48x.png differ diff --git a/public/icons/w512x.png b/public/icons/w512x.png new file mode 100644 index 0000000..c8fc1a7 Binary files /dev/null and b/public/icons/w512x.png differ diff --git a/public/icons/w57x.png b/public/icons/w57x.png new file mode 100644 index 0000000..bbac305 Binary files /dev/null and b/public/icons/w57x.png differ diff --git a/public/icons/w60x.png b/public/icons/w60x.png new file mode 100644 index 0000000..030028d Binary files /dev/null and b/public/icons/w60x.png differ diff --git a/public/icons/w64x.png b/public/icons/w64x.png new file mode 100644 index 0000000..091b696 Binary files /dev/null and b/public/icons/w64x.png differ diff --git a/public/icons/w72x.png b/public/icons/w72x.png new file mode 100644 index 0000000..dc7ae94 Binary files /dev/null and b/public/icons/w72x.png differ diff --git a/public/icons/w76x.png b/public/icons/w76x.png new file mode 100644 index 0000000..43fcd24 Binary files /dev/null and b/public/icons/w76x.png differ diff --git a/public/icons/w96x.png b/public/icons/w96x.png new file mode 100644 index 0000000..5b25031 Binary files /dev/null and b/public/icons/w96x.png differ diff --git a/public/manifest.json b/public/manifest.json deleted file mode 100644 index ac0178d..0000000 --- a/public/manifest.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "Flashii Chat", - "short_name": "Flashii Chat", - "description": "Talk about trash and trash accessories.", - "start_url": "/", - "display": "standalone", - "theme_color": "#8559a5", - "background_color": "#222", - "scope": "/", - "offline_enabled": true, - "icons": [ - { - "src": "/icons/512x.png", - "sizes": "512x512" - }, - { - "src": "/icons/256x.png", - "sizes": "256x256" - }, - { - "src": "/icons/128x.png", - "sizes": "128x128" - }, - { - "src": "/icons/90x.png", - "sizes": "90x90" - }, - { - "src": "/icons/64x.png", - "sizes": "64x64" - }, - { - "src": "/icons/48x.png", - "sizes": "48x48" - }, - { - "src": "/icons/32x.png", - "sizes": "32x32" - }, - { - "src": "/icons/16x.png", - "sizes": "16x16" - } - ] -} diff --git a/src/mami.css/_main.css b/src/mami.css/_main.css index 2ec9c7e..6e53568 100644 --- a/src/mami.css/_main.css +++ b/src/mami.css/_main.css @@ -7,12 +7,21 @@ text-size-adjust: none; } -html, +html { + /* what the fuck even is CSS anymore at this point */ + width: 100%; + width: 100vw; + width: 100dvw; + height: 100%; + height: 100vh; + height: 100dvh; +} + body { width: 100%; height: 100%; - background: #000; - color: #fff; + background: var(--theme-colour-main-background, #000); + color: var(--theme-colour-main-colour, #fff); } a { diff --git a/src/mami.css/chat.css b/src/mami.css/chat.css index d28492c..646fb9b 100644 --- a/src/mami.css/chat.css +++ b/src/mami.css/chat.css @@ -1,6 +1,5 @@ .chat { flex: 1 1 auto; - margin-bottom: 5px; overflow: auto; font-size: 12px; box-shadow: var(--theme-size-chat-box-shadow-x, 0) var(--theme-size-chat-box-shadow-y, 0) var(--theme-size-chat-box-shadow-blur, 0) var(--theme-size-chat-box-shadow-spread, 0) var(--theme-colour-chat-box-shadow, #000); diff --git a/src/mami.css/domaintrans.css b/src/mami.css/domaintrans.css index 8d600b5..6eaf40f 100644 --- a/src/mami.css/domaintrans.css +++ b/src/mami.css/domaintrans.css @@ -8,6 +8,7 @@ text-shadow: 0 0 5px #000; box-shadow: inset 0 0 1em #000; + margin: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); } .domaintrans-body { diff --git a/src/mami.css/main_cont.css b/src/mami.css/main_cont.css index af0e827..b685bed 100644 --- a/src/mami.css/main_cont.css +++ b/src/mami.css/main_cont.css @@ -1,13 +1,13 @@ .main { flex-grow: 2; flex-shrink: 1; - margin: 5px; display: flex; - flex-direction: column + gap: 4px; + flex-direction: column; } @media (max-width:768px) { .main { - margin-right: 50px + margin-right: 44px; } } diff --git a/src/mami.css/sidebar.css b/src/mami.css/sidebar.css index e804ec7..051f486 100644 --- a/src/mami.css/sidebar.css +++ b/src/mami.css/sidebar.css @@ -1,5 +1,4 @@ .sidebar { - margin: 5px 5px 5px 0; flex-shrink: 1; flex-grow: 0; font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; @@ -10,9 +9,9 @@ @media (max-width:768px) { .sidebar { position: fixed; - top: 0; - right: 0; - bottom: 0 + top: max(4px, env(safe-area-inset-top)); + right: max(4px, env(safe-area-inset-right)); + bottom: max(4px, env(safe-area-inset-bottom)); } } diff --git a/src/mami.css/umi.css b/src/mami.css/umi.css index 58a041b..2c514e4 100644 --- a/src/mami.css/umi.css +++ b/src/mami.css/umi.css @@ -2,18 +2,14 @@ font-family: Tahoma, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; - height: 100%; - width: 100%; display: flex; + gap: 4px; background-color: var(--theme-colour-main-background, #fff); color: var(--theme-colour-main-colour, #000); scrollbar-color: var(--theme-colour-scrollbar-foreground, #000) var(--theme-colour-scrollbar-background, #fff); - padding-top: env(safe-area-inset-top); - padding-bottom: env(safe-area-inset-bottom); - padding-left: env(safe-area-inset-left); - padding-right: env(safe-area-inset-right); accent-color: var(--theme-colour-main-accent, auto); color-scheme: var(--theme-scheme, normal); + padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); } .umi__main { diff --git a/src/mami.css/youare.css b/src/mami.css/youare.css index 5cf482a..82ba3ff 100644 --- a/src/mami.css/youare.css +++ b/src/mami.css/youare.css @@ -19,6 +19,7 @@ width: 100%; height: 100%; border: 1vh solid; + border-radius: env(safe-area-inset-top); /* this works well enough on my iphone, fuck it lol */ display: flex; flex-direction: column; justify-content: center; diff --git a/src/mami.html b/src/mami.html index 821e448..99d8b07 100644 --- a/src/mami.html +++ b/src/mami.html @@ -3,9 +3,16 @@ {title} - + - + + + + + + + + diff --git a/src/mami.js/main.js b/src/mami.js/main.js index 1bf1ea0..4b57db3 100644 --- a/src/mami.js/main.js +++ b/src/mami.js/main.js @@ -47,7 +47,6 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } }; return; } - loadingOverlay.setMessage('Fetching credentials...'); try { const auth = await MamiMisuzuAuth.update(); diff --git a/src/mami.js/themes.js b/src/mami.js/themes.js index 7af7698..05dcf5d 100644 --- a/src/mami.js/themes.js +++ b/src/mami.js/themes.js @@ -1,3 +1,5 @@ +#include colour.js + // try to reduce these and create variations const UmiThemes = [ { @@ -316,13 +318,16 @@ const UmiThemeApply = function(theme) { document.body.style.setProperty(varPfx + 'scheme', theme.scheme); if(theme.colours) { + if(typeof theme.colours['main-background'] === 'number') { + const themeColour = $q('meta[name="theme-color"]'); + if(themeColour instanceof Element) + themeColour.content = MamiColour.hex(theme.colours['main-background']); + } + const coloursPfx = varPfx + 'colour-'; for(const propName in theme.colours) { - document.body.style.setProperty( - coloursPfx + propName, - '#' + (theme.colours[propName].toString(16).padStart(6, '0')) - ); + document.body.style.setProperty(coloursPfx + propName, MamiColour.hex(theme.colours[propName])); } } diff --git a/src/mami.js/youare.jsx b/src/mami.js/youare.jsx index 5cdbb0f..da3c8eb 100644 --- a/src/mami.js/youare.jsx +++ b/src/mami.js/youare.jsx @@ -1,5 +1,4 @@ #include animate.js -#include rng.js const MamiYouAreAnIdiot = function() { const html =
@@ -16,7 +15,6 @@ const MamiYouAreAnIdiot = function() {
; - const rng = new MamiRNG; let soundSrc; const pub = { @@ -46,7 +44,7 @@ const MamiYouAreAnIdiot = function() { }, pushOn: async views => views.push(pub, ctx => MamiAnimate({ async: true, - duration: rng.next(1500, 15001), + duration: 1500, easing: 'outBounce', start: () => ctx.toElem.style.top = '-100%', update: t => ctx.toElem.style.top = `${-100 + (t * 100)}%`, diff --git a/src/mami.webmanifest b/src/mami.webmanifest new file mode 100644 index 0000000..3d64d31 --- /dev/null +++ b/src/mami.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "config:title", + "short_name": "config:title", + "scope": "/", + "start_url": "/", + "display": "fullscreen", + "background_color": "#000000", + "categories": ["social"], + "icons": ["autofill"] +}