From 3e5a65ff331bacc24788817ec7c4b824bda2ccd1 Mon Sep 17 00:00:00 2001 From: octospacc Date: Sat, 14 Sep 2024 23:17:03 +0200 Subject: [PATCH] Move FramesBrowser to built apps, update, add dependencies; Update build process; Add TiVuocto icon --- Build.sh | 33 ++- WriteRedirectPages.js | 1 + package-lock.json | 39 +++- package.json | 3 +- source/FramesBrowser/.gitignore | 1 + source/FramesBrowser/Build.sh | 7 + .../FramesBrowser/WebManifest.json | 0 .../FramesBrowser/html-data-url-loader.html | 34 ++++ {static => source}/FramesBrowser/icon.png | Bin {static => source}/FramesBrowser/index.html | 189 +++++++++++++----- source/FramesBrowser/package-lock.json | 56 ++++++ source/FramesBrowser/package.json | 5 + source/FramesBrowser/utils.js | 24 +++ source/TiVuOcto/Build.sh | 2 +- source/TiVuOcto/icon.jpeg | Bin 0 -> 109936 bytes source/TiVuOcto/index.html | 3 +- .../html2canvas.min.wrappedLib.js | 1 - 17 files changed, 330 insertions(+), 68 deletions(-) mode change 100644 => 100755 WriteRedirectPages.js create mode 100644 source/FramesBrowser/.gitignore create mode 100755 source/FramesBrowser/Build.sh rename static/FramesBrowser/manifest.json => source/FramesBrowser/WebManifest.json (100%) create mode 100644 source/FramesBrowser/html-data-url-loader.html rename {static => source}/FramesBrowser/icon.png (100%) rename {static => source}/FramesBrowser/index.html (81%) create mode 100644 source/FramesBrowser/package-lock.json create mode 100644 source/FramesBrowser/package.json create mode 100644 source/FramesBrowser/utils.js create mode 100644 source/TiVuOcto/icon.jpeg delete mode 100644 static/FramesBrowser/html2canvas.min.wrappedLib.js diff --git a/Build.sh b/Build.sh index 4855b69..0900aa7 100755 --- a/Build.sh +++ b/Build.sh @@ -12,6 +12,15 @@ getMetaAttr(){ grep '' | cut -d '"' -f4 } +################################################################################ + +npm update +npm install +cd ./node_modules/SpaccDotWeb +npm install +npm run build:lib +cd ../.. + rm -vrf ./public || true cp -vr ./static ./public cp -vr ./shared ./public/shared @@ -21,9 +30,9 @@ do mkdir -p "./public/${App}" cd "./source/${App}" if [ -f ./Requirements.sh ] - then sh ./Requirements.sh - else - [ -f ./package.json ] && (npm update; npm install) + then sh ./Requirements.sh + elif [ -f ./package.json ] + then (npm update; npm install) fi copyfiles="$(sh ./Build.sh)" cp -vr $copyfiles "../../public/${App}/" @@ -42,13 +51,17 @@ node ../WriteRedirectPages.js for App in ${HubSdkApps} do - file="./${App}/index.html" - name="$( getMetaAttr "${file}" og:title)" - description="$(getMetaAttr "${file}" og:description)" - url="$( getMetaAttr "${file}" OctoSpaccHubSdk:Url)" - cat << [OctoSpaccHubSdk-WebManifest-EOF] > "./${App}/WebManifest.json" + htmlfile="./${App}/index.html" + jsonfile="./${App}/WebManifest.json" + if [ -f "${jsonfile}" ] + then continue + fi + name="$( getMetaAttr "${htmlfile}" og:title)" + description="$(getMetaAttr "${htmlfile}" og:description)" + url="$( getMetaAttr "${htmlfile}" OctoSpaccHubSdk:Url)" + cat << [OctoSpaccHubSdk-WebManifest-EOF] > "${jsonfile}" { - $(getMetaAttr "${file}" OctoSpaccHubSdk:WebManifestExtra | sed s/\'/\"/g) + $(getMetaAttr "${htmlfile}" OctoSpaccHubSdk:WebManifestExtra | sed s/\'/\"/g) $([ -n "${description}" ] && echo "$(quoteVar description): $(quoteVar "${description}"),") "start_url": "${url}", "scope": "${url}", @@ -57,5 +70,5 @@ do [OctoSpaccHubSdk-WebManifest-EOF] htmltitle=''"${name}"'' htmlcanonical='' - sed -i 's||'"${htmltitle}${htmlcanonical}${htmlmanifest}${HtmlHeadInject}"'|' "${file}" + sed -i 's||'"${htmltitle}${htmlcanonical}${htmlmanifest}${HtmlHeadInject}"'|' "${htmlfile}" done diff --git a/WriteRedirectPages.js b/WriteRedirectPages.js old mode 100644 new mode 100755 index 183165a..abfd646 --- a/WriteRedirectPages.js +++ b/WriteRedirectPages.js @@ -1,3 +1,4 @@ +#!/usr/bin/env node const fs = require('fs'); for (const page of [ { path: "a/fb", target: "'../../FramesBrowser/'+location.hash" }, // Apps/FramesBrowser diff --git a/package-lock.json b/package-lock.json index d3c016c..f37f30e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,8 @@ "devDependencies": { "@babel/cli": "^7.23.9", "@babel/core": "^7.23.9", - "@babel/preset-env": "^7.23.9" + "@babel/preset-env": "^7.23.9", + "SpaccDotWeb": "gitlab:SpaccInc/SpaccDotWeb" } }, "node_modules/@ampproject/remapping": { @@ -2324,6 +2325,27 @@ "semver": "bin/semver" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2367,6 +2389,12 @@ "wrappy": "1" } }, + "node_modules/parse-multipart-data": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/parse-multipart-data/-/parse-multipart-data-1.5.0.tgz", + "integrity": "sha512-ck5zaMF0ydjGfejNMnlo5YU2oJ+pT+80Jb1y4ybanT27j+zbVP/jkYmCrUGsEln0Ox/hZmuvgy8Ra7AxbXP2Mw==", + "dev": true + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -2529,6 +2557,15 @@ "node": ">=6" } }, + "node_modules/SpaccDotWeb": { + "version": "indev", + "resolved": "git+ssh://git@gitlab.com/SpaccInc/SpaccDotWeb.git#9b23a57eeb50f32627cdd182070eb722118c1554", + "dev": true, + "dependencies": { + "mime-types": "^2.1.35", + "parse-multipart-data": "^1.5.0" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", diff --git a/package.json b/package.json index 0ec2a0c..6dc8426 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "devDependencies": { "@babel/cli": "^7.23.9", "@babel/core": "^7.23.9", - "@babel/preset-env": "^7.23.9" + "@babel/preset-env": "^7.23.9", + "SpaccDotWeb": "gitlab:SpaccInc/SpaccDotWeb" } } diff --git a/source/FramesBrowser/.gitignore b/source/FramesBrowser/.gitignore new file mode 100644 index 0000000..5de0681 --- /dev/null +++ b/source/FramesBrowser/.gitignore @@ -0,0 +1 @@ +/html-data-url-loader-?.html diff --git a/source/FramesBrowser/Build.sh b/source/FramesBrowser/Build.sh new file mode 100755 index 0000000..0cc6837 --- /dev/null +++ b/source/FramesBrowser/Build.sh @@ -0,0 +1,7 @@ +#!/bin/sh +for i in 0 1 +do cp ./html-data-url-loader.html "./html-data-url-loader-${i}.html" +done +#echo "const fs=require('fs'); fs.writeFileSync('html2canvas.min.wrappedLib.js', 'window.FramesBrowser.Lib.html2canvas=' + JSON.stringify(fs.readFileSync('node_modules/html2canvas/dist/html2canvas.min.js', 'utf8')) + ';');" | node +echo index.html utils.js WebManifest.json icon.png html-data-url-loader-?.html \ + node_modules/html2canvas/dist/html2canvas.min.js diff --git a/static/FramesBrowser/manifest.json b/source/FramesBrowser/WebManifest.json similarity index 100% rename from static/FramesBrowser/manifest.json rename to source/FramesBrowser/WebManifest.json diff --git a/source/FramesBrowser/html-data-url-loader.html b/source/FramesBrowser/html-data-url-loader.html new file mode 100644 index 0000000..112e561 --- /dev/null +++ b/source/FramesBrowser/html-data-url-loader.html @@ -0,0 +1,34 @@ + + + + + + + + + diff --git a/static/FramesBrowser/icon.png b/source/FramesBrowser/icon.png similarity index 100% rename from static/FramesBrowser/icon.png rename to source/FramesBrowser/icon.png diff --git a/static/FramesBrowser/index.html b/source/FramesBrowser/index.html similarity index 81% rename from static/FramesBrowser/index.html rename to source/FramesBrowser/index.html index fb2f2e0..c7c219d 100644 --- a/static/FramesBrowser/index.html +++ b/source/FramesBrowser/index.html @@ -2,14 +2,16 @@ @@ -19,7 +21,7 @@ - + 🪟️ Frames Browser @@ -29,7 +31,7 @@ --BaseMargin: 8px; --BtnHeight: calc(1rem + var(--BaseMargin)); --BtnActionHeight: calc(2rem + var(--BaseMargin)); - --BtnActionWidth: calc(2.5rem + var(--BaseMargin)); + --BtnActionWidth: calc(3rem + var(--BaseMargin)); --ColorBg: #f0f0f0; --ColorFg: #0f0f0f; } @@ -39,11 +41,15 @@ body { margin: 0px; max-width: 100vw; - max-height: 100vh; + max-height: 100%; + position: absolute; } button { height: var(--BtnHeight); } + #MainAppContent { + height: 100%; + } iframe, #IframeMain, #IframeMainBox { border: none; width: 100%; @@ -111,7 +117,10 @@ } + + + @@ -129,7 +138,7 @@ - +
@@ -168,6 +177,11 @@
  • Clicking "📐️ Tools" will open or close the Eruda console as desired. (Note that Eruda is currently only injected in the root window and not inside any iFrame.)
  • Changelog

    +

    2024-09-14

    2024-09-13