From 9f9d66afebc59c6c265c4424f7b8fb36d8876541 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Thu, 26 Oct 2023 16:39:03 +0200 Subject: Updated 34 files and added 146 files (automated) --- .DS_Store | Bin 14340 -> 16388 bytes .gitignore | 3 +- .idea/deployment.xml | 2 + .idea/vcs.xml | 6 + api/addHistory.php | 9 + app/download.php | 74 + app/explore.php | 23 +- app/index.php | 46 +- app/info.php | 186 ++ app/listing.php | 24 - app/lyrics.php | 8 +- app/modal.php | 48 + app/navigation.php | 3 + app/player-mobile.php | 2 +- app/queue.php | 78 + app/search.php | 91 + app/settings.php | 2 +- assets/.DS_Store | Bin 10244 -> 10244 bytes assets/dark.css | 52 +- assets/icons/add.svg | 1 + assets/icons/download.svg | 1 + assets/icons/info.svg | 1 + assets/icons/menu.svg | 1 + assets/icons/playlist.svg | 2 +- assets/icons/playnext.svg | 1 + assets/icons/remove.svg | 1 + assets/icons/settings.svg | 2 +- assets/logo-display.ico | Bin 0 -> 13603 bytes assets/logo-mac.png | Bin 0 -> 386333 bytes assets/logo.icns | Bin 0 -> 420932 bytes assets/styles.css | 18 +- build.sh | 8 + desktop/package.json | 1 + icons/maskable.png | Bin 17018 -> 15075 bytes icons/maskable.svg | 100 +- icons/maskable_128x128.png | Bin 8496 -> 7231 bytes icons/maskable_144x144.png | Bin 9620 -> 8334 bytes icons/maskable_152x152.png | Bin 10223 -> 8844 bytes icons/maskable_192x192.png | Bin 13286 -> 11503 bytes icons/maskable_256x256.png | Bin 18494 -> 15991 bytes icons/maskable_384x384.png | Bin 29306 -> 25823 bytes icons/maskable_64x64.png | Bin 3752 -> 3138 bytes icons/maskable_72x72.png | Bin 4375 -> 3649 bytes icons/maskable_96x96.png | Bin 6062 -> 5172 bytes includes/.DS_Store | Bin 6148 -> 6148 bytes includes/editor.js | 193 ++ includes/node_modules/.package-lock.json | 97 + includes/node_modules/ansi-styles/index.d.ts | 345 ++++ includes/node_modules/ansi-styles/index.js | 163 ++ includes/node_modules/ansi-styles/license | 9 + includes/node_modules/ansi-styles/package.json | 56 + includes/node_modules/ansi-styles/readme.md | 152 ++ includes/node_modules/chalk/index.d.ts | 415 ++++ includes/node_modules/chalk/license | 9 + includes/node_modules/chalk/package.json | 68 + includes/node_modules/chalk/readme.md | 341 ++++ includes/node_modules/chalk/source/index.js | 229 +++ includes/node_modules/chalk/source/templates.js | 134 ++ includes/node_modules/chalk/source/util.js | 39 + includes/node_modules/color-convert/CHANGELOG.md | 54 + includes/node_modules/color-convert/LICENSE | 21 + includes/node_modules/color-convert/README.md | 68 + includes/node_modules/color-convert/conversions.js | 839 ++++++++ includes/node_modules/color-convert/index.js | 81 + includes/node_modules/color-convert/package.json | 48 + includes/node_modules/color-convert/route.js | 97 + includes/node_modules/color-name/LICENSE | 8 + includes/node_modules/color-name/README.md | 11 + includes/node_modules/color-name/index.js | 152 ++ includes/node_modules/color-name/package.json | 28 + includes/node_modules/fuse.js/LICENSE | 201 ++ includes/node_modules/fuse.js/README.md | 61 + includes/node_modules/fuse.js/dist/fuse.basic.cjs | 1329 +++++++++++++ includes/node_modules/fuse.js/dist/fuse.basic.js | 1335 +++++++++++++ .../node_modules/fuse.js/dist/fuse.basic.min.cjs | 9 + .../node_modules/fuse.js/dist/fuse.basic.min.js | 9 + .../node_modules/fuse.js/dist/fuse.basic.min.mjs | 9 + includes/node_modules/fuse.js/dist/fuse.basic.mjs | 1259 ++++++++++++ includes/node_modules/fuse.js/dist/fuse.cjs | 2004 +++++++++++++++++++ includes/node_modules/fuse.js/dist/fuse.d.ts | 368 ++++ includes/node_modules/fuse.js/dist/fuse.js | 2010 ++++++++++++++++++++ includes/node_modules/fuse.js/dist/fuse.min.cjs | 9 + includes/node_modules/fuse.js/dist/fuse.min.js | 9 + includes/node_modules/fuse.js/dist/fuse.min.mjs | 9 + includes/node_modules/fuse.js/dist/fuse.mjs | 1778 +++++++++++++++++ includes/node_modules/fuse.js/package.json | 118 ++ includes/node_modules/has-flag/index.d.ts | 39 + includes/node_modules/has-flag/index.js | 8 + includes/node_modules/has-flag/license | 9 + includes/node_modules/has-flag/package.json | 46 + includes/node_modules/has-flag/readme.md | 89 + includes/node_modules/kleur/index.js | 104 + includes/node_modules/kleur/kleur.d.ts | 45 + includes/node_modules/kleur/license | 21 + includes/node_modules/kleur/package.json | 35 + includes/node_modules/kleur/readme.md | 172 ++ .../prompts/dist/dateparts/datepart.js | 39 + .../node_modules/prompts/dist/dateparts/day.js | 35 + .../node_modules/prompts/dist/dateparts/hours.js | 30 + .../node_modules/prompts/dist/dateparts/index.js | 13 + .../prompts/dist/dateparts/meridiem.js | 25 + .../prompts/dist/dateparts/milliseconds.js | 28 + .../node_modules/prompts/dist/dateparts/minutes.js | 29 + .../node_modules/prompts/dist/dateparts/month.js | 31 + .../node_modules/prompts/dist/dateparts/seconds.js | 29 + .../node_modules/prompts/dist/dateparts/year.js | 29 + .../prompts/dist/elements/autocomplete.js | 285 +++ .../dist/elements/autocompleteMultiselect.js | 201 ++ .../node_modules/prompts/dist/elements/confirm.js | 93 + .../node_modules/prompts/dist/elements/date.js | 250 +++ .../node_modules/prompts/dist/elements/index.js | 13 + .../prompts/dist/elements/multiselect.js | 289 +++ .../node_modules/prompts/dist/elements/number.js | 250 +++ .../node_modules/prompts/dist/elements/prompt.js | 82 + .../node_modules/prompts/dist/elements/select.js | 190 ++ .../node_modules/prompts/dist/elements/text.js | 245 +++ .../node_modules/prompts/dist/elements/toggle.js | 124 ++ includes/node_modules/prompts/dist/index.js | 154 ++ includes/node_modules/prompts/dist/prompts.js | 222 +++ includes/node_modules/prompts/dist/util/action.js | 38 + includes/node_modules/prompts/dist/util/clear.js | 42 + .../prompts/dist/util/entriesToDisplay.js | 21 + includes/node_modules/prompts/dist/util/figures.js | 32 + includes/node_modules/prompts/dist/util/index.js | 12 + includes/node_modules/prompts/dist/util/lines.js | 14 + includes/node_modules/prompts/dist/util/strip.js | 7 + includes/node_modules/prompts/dist/util/style.js | 51 + includes/node_modules/prompts/dist/util/wrap.js | 16 + includes/node_modules/prompts/index.js | 14 + .../node_modules/prompts/lib/dateparts/datepart.js | 35 + includes/node_modules/prompts/lib/dateparts/day.js | 42 + .../node_modules/prompts/lib/dateparts/hours.js | 30 + .../node_modules/prompts/lib/dateparts/index.js | 13 + .../node_modules/prompts/lib/dateparts/meridiem.js | 24 + .../prompts/lib/dateparts/milliseconds.js | 28 + .../node_modules/prompts/lib/dateparts/minutes.js | 28 + .../node_modules/prompts/lib/dateparts/month.js | 33 + .../node_modules/prompts/lib/dateparts/seconds.js | 28 + .../node_modules/prompts/lib/dateparts/year.js | 28 + .../prompts/lib/elements/autocomplete.js | 264 +++ .../lib/elements/autocompleteMultiselect.js | 194 ++ .../node_modules/prompts/lib/elements/confirm.js | 89 + includes/node_modules/prompts/lib/elements/date.js | 209 ++ .../node_modules/prompts/lib/elements/index.js | 13 + .../prompts/lib/elements/multiselect.js | 271 +++ .../node_modules/prompts/lib/elements/number.js | 213 +++ .../node_modules/prompts/lib/elements/prompt.js | 68 + .../node_modules/prompts/lib/elements/select.js | 175 ++ includes/node_modules/prompts/lib/elements/text.js | 208 ++ .../node_modules/prompts/lib/elements/toggle.js | 118 ++ includes/node_modules/prompts/lib/index.js | 98 + includes/node_modules/prompts/lib/prompts.js | 206 ++ includes/node_modules/prompts/lib/util/action.js | 39 + includes/node_modules/prompts/lib/util/clear.js | 22 + .../prompts/lib/util/entriesToDisplay.js | 21 + includes/node_modules/prompts/lib/util/figures.js | 33 + includes/node_modules/prompts/lib/util/index.js | 12 + includes/node_modules/prompts/lib/util/lines.js | 15 + includes/node_modules/prompts/lib/util/strip.js | 11 + includes/node_modules/prompts/lib/util/style.js | 40 + includes/node_modules/prompts/lib/util/wrap.js | 27 + includes/node_modules/prompts/license | 21 + includes/node_modules/prompts/package.json | 53 + includes/node_modules/prompts/readme.md | 882 +++++++++ includes/node_modules/sisteransi/license | 21 + includes/node_modules/sisteransi/package.json | 34 + includes/node_modules/sisteransi/readme.md | 113 ++ includes/node_modules/sisteransi/src/index.js | 58 + .../node_modules/sisteransi/src/sisteransi.d.ts | 35 + includes/node_modules/supports-color/browser.js | 5 + includes/node_modules/supports-color/index.js | 135 ++ includes/node_modules/supports-color/license | 9 + includes/node_modules/supports-color/package.json | 53 + includes/node_modules/supports-color/readme.md | 76 + includes/package-lock.json | 102 +- includes/package.json | 5 +- includes/process.js | 230 ++- includes/reset.js | 12 + includes/session.php | 85 +- version | 2 +- 180 files changed, 22897 insertions(+), 138 deletions(-) create mode 100644 .idea/vcs.xml create mode 100644 api/addHistory.php create mode 100644 app/download.php create mode 100644 app/info.php create mode 100644 app/modal.php create mode 100644 app/queue.php create mode 100644 app/search.php create mode 100644 assets/icons/add.svg create mode 100644 assets/icons/download.svg create mode 100644 assets/icons/info.svg create mode 100644 assets/icons/menu.svg create mode 100644 assets/icons/playnext.svg create mode 100644 assets/icons/remove.svg create mode 100644 assets/logo-display.ico create mode 100644 assets/logo-mac.png create mode 100644 assets/logo.icns create mode 100755 build.sh create mode 100644 includes/editor.js create mode 100644 includes/node_modules/ansi-styles/index.d.ts create mode 100644 includes/node_modules/ansi-styles/index.js create mode 100644 includes/node_modules/ansi-styles/license create mode 100644 includes/node_modules/ansi-styles/package.json create mode 100644 includes/node_modules/ansi-styles/readme.md create mode 100644 includes/node_modules/chalk/index.d.ts create mode 100644 includes/node_modules/chalk/license create mode 100644 includes/node_modules/chalk/package.json create mode 100644 includes/node_modules/chalk/readme.md create mode 100644 includes/node_modules/chalk/source/index.js create mode 100644 includes/node_modules/chalk/source/templates.js create mode 100644 includes/node_modules/chalk/source/util.js create mode 100644 includes/node_modules/color-convert/CHANGELOG.md create mode 100644 includes/node_modules/color-convert/LICENSE create mode 100644 includes/node_modules/color-convert/README.md create mode 100644 includes/node_modules/color-convert/conversions.js create mode 100644 includes/node_modules/color-convert/index.js create mode 100644 includes/node_modules/color-convert/package.json create mode 100644 includes/node_modules/color-convert/route.js create mode 100644 includes/node_modules/color-name/LICENSE create mode 100644 includes/node_modules/color-name/README.md create mode 100644 includes/node_modules/color-name/index.js create mode 100644 includes/node_modules/color-name/package.json create mode 100644 includes/node_modules/fuse.js/LICENSE create mode 100644 includes/node_modules/fuse.js/README.md create mode 100644 includes/node_modules/fuse.js/dist/fuse.basic.cjs create mode 100644 includes/node_modules/fuse.js/dist/fuse.basic.js create mode 100644 includes/node_modules/fuse.js/dist/fuse.basic.min.cjs create mode 100644 includes/node_modules/fuse.js/dist/fuse.basic.min.js create mode 100644 includes/node_modules/fuse.js/dist/fuse.basic.min.mjs create mode 100644 includes/node_modules/fuse.js/dist/fuse.basic.mjs create mode 100644 includes/node_modules/fuse.js/dist/fuse.cjs create mode 100644 includes/node_modules/fuse.js/dist/fuse.d.ts create mode 100644 includes/node_modules/fuse.js/dist/fuse.js create mode 100644 includes/node_modules/fuse.js/dist/fuse.min.cjs create mode 100644 includes/node_modules/fuse.js/dist/fuse.min.js create mode 100644 includes/node_modules/fuse.js/dist/fuse.min.mjs create mode 100644 includes/node_modules/fuse.js/dist/fuse.mjs create mode 100644 includes/node_modules/fuse.js/package.json create mode 100644 includes/node_modules/has-flag/index.d.ts create mode 100644 includes/node_modules/has-flag/index.js create mode 100644 includes/node_modules/has-flag/license create mode 100644 includes/node_modules/has-flag/package.json create mode 100644 includes/node_modules/has-flag/readme.md create mode 100644 includes/node_modules/kleur/index.js create mode 100644 includes/node_modules/kleur/kleur.d.ts create mode 100644 includes/node_modules/kleur/license create mode 100644 includes/node_modules/kleur/package.json create mode 100644 includes/node_modules/kleur/readme.md create mode 100644 includes/node_modules/prompts/dist/dateparts/datepart.js create mode 100644 includes/node_modules/prompts/dist/dateparts/day.js create mode 100644 includes/node_modules/prompts/dist/dateparts/hours.js create mode 100644 includes/node_modules/prompts/dist/dateparts/index.js create mode 100644 includes/node_modules/prompts/dist/dateparts/meridiem.js create mode 100644 includes/node_modules/prompts/dist/dateparts/milliseconds.js create mode 100644 includes/node_modules/prompts/dist/dateparts/minutes.js create mode 100644 includes/node_modules/prompts/dist/dateparts/month.js create mode 100644 includes/node_modules/prompts/dist/dateparts/seconds.js create mode 100644 includes/node_modules/prompts/dist/dateparts/year.js create mode 100644 includes/node_modules/prompts/dist/elements/autocomplete.js create mode 100644 includes/node_modules/prompts/dist/elements/autocompleteMultiselect.js create mode 100644 includes/node_modules/prompts/dist/elements/confirm.js create mode 100644 includes/node_modules/prompts/dist/elements/date.js create mode 100644 includes/node_modules/prompts/dist/elements/index.js create mode 100644 includes/node_modules/prompts/dist/elements/multiselect.js create mode 100644 includes/node_modules/prompts/dist/elements/number.js create mode 100644 includes/node_modules/prompts/dist/elements/prompt.js create mode 100644 includes/node_modules/prompts/dist/elements/select.js create mode 100644 includes/node_modules/prompts/dist/elements/text.js create mode 100644 includes/node_modules/prompts/dist/elements/toggle.js create mode 100644 includes/node_modules/prompts/dist/index.js create mode 100644 includes/node_modules/prompts/dist/prompts.js create mode 100644 includes/node_modules/prompts/dist/util/action.js create mode 100644 includes/node_modules/prompts/dist/util/clear.js create mode 100644 includes/node_modules/prompts/dist/util/entriesToDisplay.js create mode 100644 includes/node_modules/prompts/dist/util/figures.js create mode 100644 includes/node_modules/prompts/dist/util/index.js create mode 100644 includes/node_modules/prompts/dist/util/lines.js create mode 100644 includes/node_modules/prompts/dist/util/strip.js create mode 100644 includes/node_modules/prompts/dist/util/style.js create mode 100644 includes/node_modules/prompts/dist/util/wrap.js create mode 100644 includes/node_modules/prompts/index.js create mode 100644 includes/node_modules/prompts/lib/dateparts/datepart.js create mode 100644 includes/node_modules/prompts/lib/dateparts/day.js create mode 100644 includes/node_modules/prompts/lib/dateparts/hours.js create mode 100644 includes/node_modules/prompts/lib/dateparts/index.js create mode 100644 includes/node_modules/prompts/lib/dateparts/meridiem.js create mode 100644 includes/node_modules/prompts/lib/dateparts/milliseconds.js create mode 100644 includes/node_modules/prompts/lib/dateparts/minutes.js create mode 100644 includes/node_modules/prompts/lib/dateparts/month.js create mode 100644 includes/node_modules/prompts/lib/dateparts/seconds.js create mode 100644 includes/node_modules/prompts/lib/dateparts/year.js create mode 100644 includes/node_modules/prompts/lib/elements/autocomplete.js create mode 100644 includes/node_modules/prompts/lib/elements/autocompleteMultiselect.js create mode 100644 includes/node_modules/prompts/lib/elements/confirm.js create mode 100644 includes/node_modules/prompts/lib/elements/date.js create mode 100644 includes/node_modules/prompts/lib/elements/index.js create mode 100644 includes/node_modules/prompts/lib/elements/multiselect.js create mode 100644 includes/node_modules/prompts/lib/elements/number.js create mode 100644 includes/node_modules/prompts/lib/elements/prompt.js create mode 100644 includes/node_modules/prompts/lib/elements/select.js create mode 100644 includes/node_modules/prompts/lib/elements/text.js create mode 100644 includes/node_modules/prompts/lib/elements/toggle.js create mode 100644 includes/node_modules/prompts/lib/index.js create mode 100644 includes/node_modules/prompts/lib/prompts.js create mode 100644 includes/node_modules/prompts/lib/util/action.js create mode 100644 includes/node_modules/prompts/lib/util/clear.js create mode 100644 includes/node_modules/prompts/lib/util/entriesToDisplay.js create mode 100644 includes/node_modules/prompts/lib/util/figures.js create mode 100644 includes/node_modules/prompts/lib/util/index.js create mode 100644 includes/node_modules/prompts/lib/util/lines.js create mode 100644 includes/node_modules/prompts/lib/util/strip.js create mode 100644 includes/node_modules/prompts/lib/util/style.js create mode 100644 includes/node_modules/prompts/lib/util/wrap.js create mode 100644 includes/node_modules/prompts/license create mode 100644 includes/node_modules/prompts/package.json create mode 100755 includes/node_modules/prompts/readme.md create mode 100644 includes/node_modules/sisteransi/license create mode 100755 includes/node_modules/sisteransi/package.json create mode 100755 includes/node_modules/sisteransi/readme.md create mode 100644 includes/node_modules/sisteransi/src/index.js create mode 100644 includes/node_modules/sisteransi/src/sisteransi.d.ts create mode 100644 includes/node_modules/supports-color/browser.js create mode 100644 includes/node_modules/supports-color/index.js create mode 100644 includes/node_modules/supports-color/license create mode 100644 includes/node_modules/supports-color/package.json create mode 100644 includes/node_modules/supports-color/readme.md create mode 100644 includes/reset.js diff --git a/.DS_Store b/.DS_Store index cba7b56..4087871 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 66bc8ac..2f42df5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ includes/app.json includes/tokens includes/users -assets/content \ No newline at end of file +assets/content +build \ No newline at end of file diff --git a/.idea/deployment.xml b/.idea/deployment.xml index 80c15f7..4500cde 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -10,6 +10,8 @@ + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/api/addHistory.php b/api/addHistory.php new file mode 100644 index 0000000..cc35409 --- /dev/null +++ b/api/addHistory.php @@ -0,0 +1,9 @@ +", ":", "\"", "\\", "|", "?", "*"], "-", $song["artist"] . " - " . $song["title"]); + +function getSize($bytes) { + if ($bytes < 1024) { + return $bytes; + } + + if ($bytes < 1024**2) { + return round($bytes / 1024, 1) . " KB"; + } + + if ($bytes < 1024**3) { + return round($bytes / 1024**2, 1) . " MB"; + } + + return round($bytes / 1024**3, 1) . " GB"; +} + +?> + + + + + + + download + + + + + + + + + + + +
+

+
+ +

+ +

Select the version of the song you would like to download:

+ +
+ + + + \ No newline at end of file diff --git a/app/explore.php b/app/explore.php index a51731b..4887022 100644 --- a/app/explore.php +++ b/app/explore.php @@ -1,4 +1,4 @@ - + @@ -25,7 +25,26 @@

-

Explore

+

Explore

+ +
+
+ + +
+
+ +
+ + +
+
+ +

Upload music to this server

+

Add millions of songs and let your users play them whenever they want.

+
+
+
- +class="web"> @@ -182,8 +182,8 @@ } if (playlist[currentPlaylistPosition + 1]) { - playSong(playlist[currentPlaylistPosition + 1], "keep"); currentPlaylistPosition++; + playSong(playlist[currentPlaylistPosition], "keep", false); } else { stop(); } @@ -307,18 +307,18 @@ playerDocument.getElementById("badge-lossy").style.display = "none"; playerDocument.getElementById("badge-cd").style.display = "none"; playerDocument.getElementById("badge-hires").style.display = "inline"; - playerDocument.getElementById("badge-hires").innerHTML = "Hi-Res Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000).toFixed(1) + " kHz"; + playerDocument.getElementById("badge-hires").innerHTML = "Hi-Res Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000) + " kHz"; playerDocumentMobile.getElementById("badge-lossy").style.display = "none"; playerDocumentMobile.getElementById("badge-cd").style.display = "none"; playerDocumentMobile.getElementById("badge-hires").style.display = "inline"; } else if (window.currentSong) { - playerDocument.getElementById("badge-lossy").style.display = "inline"; + playerDocument.getElementById("badge-lossy").style.display = "none"; playerDocument.getElementById("badge-cd").style.display = "inline"; playerDocument.getElementById("badge-hires").style.display = "none"; - playerDocumentMobile.getElementById("badge-lossy").style.display = "inline"; + playerDocumentMobile.getElementById("badge-lossy").style.display = "none"; playerDocumentMobile.getElementById("badge-cd").style.display = "inline"; playerDocumentMobile.getElementById("badge-hires").style.display = "none"; - playerDocument.getElementById("badge-cd").innerHTML = "'>Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000).toFixed(1) + " kHz"; + playerDocument.getElementById("badge-cd").innerHTML = "Lossless" + window.currentSong.bitDepth + "-bit " + (window.currentSong.sampleRate / 1000) + " kHz"; } } @@ -347,30 +347,34 @@ } } - window.redownloadFavorite = async () => { + window.redownloadFavorites = async () => { document.getElementById("loading-text").innerText = "Downloading favorites..."; - window.favorites = await (await fetch("/api/getFavorites.php")).json(); + window.favorites = await (await fetch("/api/getFavorites.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); } window.redownloadLibrary = async () => { document.getElementById("loading-text").innerText = "Downloading library..."; - window.favorites = await (await fetch("/api/getLibrary.php")).json(); + window.library = await (await fetch("/api/getLibrary.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); } (async () => { document.getElementById("loading-text").innerText = "Downloading list of songs..."; - window.songs = await (await fetch("/assets/content/songs.json")).json(); + window.songs = await (await fetch("/assets/content/songs.json?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); document.getElementById("loading-text").innerText = "Downloading list of albums..."; - window.albums = await (await fetch("/assets/content/albums.json")).json(); + window.albums = await (await fetch("/assets/content/albums.json?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); document.getElementById("loading-text").innerText = "Downloading favorites..."; - window.favorites = await (await fetch("/api/getFavorites.php")).json(); + window.favorites = await (await fetch("/api/getFavorites.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); + + document.getElementById("loading-text").innerText = "Downloading library..."; + window.library = await (await fetch("/api/getLibrary.php?_=" + [...crypto.getRandomValues(new Uint8Array(40))].map(m=>('0'+m.toString(16)).slice(-2)).join(''))).json(); document.getElementById("loading-text").innerText = "Saving database..."; await localforage.setItem("albums", window.albums); await localforage.setItem("songs", window.songs); await localforage.setItem("favorites", window.favorites); + await localforage.setItem("library", window.library); document.getElementById("loading-text").innerText = "Done loading."; document.getElementById("loading").style.display = "none"; @@ -455,7 +459,7 @@ window.currentPlaylistID = null; - window.playSong = async (id, playlistID) => { + window.playSong = async (id, playlistID, updatePosition) => { playerDocument.getElementById("player-audio").pause(); playerDocument.getElementById("player-audio").currentTime = 0; @@ -471,6 +475,8 @@ } else if (playlistID !== "keep") { window.playlist = [id]; window.currentPlaylistPosition = 0; + } else if (typeof updatePosition !== "boolean" || updatePosition) { + window.currentPlaylistPosition = window.playlist.indexOf(id) ?? 0; } } else { window.currentPlaylistID = null; @@ -481,6 +487,7 @@ window.currentSong = songs[id]; window.currentSongID = id; updateDisplay(); + if (document.getElementById("ui").contentWindow.refreshQueue) document.getElementById("ui").contentWindow.refreshQueue(); if (!window.preloaded[id]) { if (localStorage.getItem("data-saving") === "true") { @@ -547,5 +554,16 @@ } } + + + \ No newline at end of file diff --git a/app/info.php b/app/info.php new file mode 100644 index 0000000..cfc7bc2 --- /dev/null +++ b/app/info.php @@ -0,0 +1,186 @@ +", ":", "\"", "\\", "|", "?", "*"], "-", $song["artist"] . " - " . $song["title"]); + +function getSize($bytes) { + if ($bytes < 1024) { + return $bytes; + } + + if ($bytes < 1024**2) { + return round($bytes / 1024, 1) . " KB"; + } + + if ($bytes < 1024**3) { + return round($bytes / 1024**2, 1) . " MB"; + } + + return round($bytes / 1024**3, 1) . " GB"; +} + +function timeToDuration($seconds) { + $hours = floor($seconds / 3600); + $minutes = floor($seconds / 60) - ($hours * 60); + $seconds = floor($seconds) - ($hours * 3600) - ($minutes * 60); + $parts = []; + + if ($hours > 0) $parts[] = $hours . " hour" . ($hours > 1 ? "s" : ""); + if ($minutes > 0) $parts[] = $minutes . " minute" . ($minutes > 1 ? "s" : ""); + if ($seconds > 0) $parts[] = $seconds . " second" . ($seconds > 1 ? "s" : ""); + + return implode(", ", $parts); +} + +function getBitRate($bits) { + $bitsValue = $bits . " bps"; + + if ($bits > 1000) { + if ($bits > 1000000) { + if ($bits > 1000000000) { + $bitsValue = round($bits / 1000000000, 2) . " Gbps"; + } else { + $bitsValue = round($bits / 1000000, 2) . " Mbps"; + } + } else { + $bitsValue = round($bits / 1000, 2) . " kbps"; + } + } + + $bytesValue = ($bits / 8) . " B/s"; + + if (($bits / 8) > 1000) { + if (($bits / 8) > 1000000) { + if (($bits / 8) > 1000000000) { + $bytesValue = round(($bits / 8) / 1000000000, 2) . " GB/s"; + } else { + $bytesValue = round(($bits / 8) / 1000000, 2) . " MB/s"; + } + } else { + $bytesValue = round(($bits / 8) / 1000, 2) . " kB/s"; + } + } + + return $bitsValue . " (" . $bytesValue . ")"; +} + +function getChannelConfiguration($c) { + if ($c === 1) return " (Mono)"; + if ($c === 2) return " (Stereo)"; + if ($c === 3) return " (Stereo+1)"; + if ($c === 4) return " (3.1)"; + if ($c === 5) return " (4.1 or 5.0 Surround)"; + if ($c === 6) return " (5.1 Surround)"; + if ($c === 7) return " (6.1 or 7.0 Surround)"; + if ($c === 8) return " (7.1 Surround)"; + if ($c === 9) return " (9.0 or 7.2 Spatial Audio)"; + if ($c === 10) return " (9.1 Spatial Audio)"; + if ($c >= 11) return " (Dolby Atmos)"; + return ""; +} + +?> + + + + + + + info + + + + + + + + + + + +
+
+ .jpg" style="aspect-ratio: 1; width: 96px;"> +
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TrackDisc , track 0 ? $song["track"] : "-" ?>
Duration
Bit rate
Sample rate Hz
Bits per sample bits
Channels
Year
High-resolution
Mist StellaNo
Copyright
File size (lossless)
File size (AAC-LC)
+
+ + + + \ No newline at end of file diff --git a/app/listing.php b/app/listing.php index 8ea25d4..9d50178 100644 --- a/app/listing.php +++ b/app/listing.php @@ -148,30 +148,6 @@ if (!$presetList) { } - async function favoriteSong(id) { - document.getElementById("btn-favorite-" + id + "-icon").src = "/assets/icons/favorite-on.svg"; - document.getElementById("btn-favorite-" + id).onclick = () => { - unfavoriteSong(id); - } - await fetch("/api/addFavorite.php?i=" + id); - - window.parent.redownloadFavorites(); - } - - async function unfavoriteSong(id) { - document.getElementById("btn-favorite-" + id + "-icon").src = "/assets/icons/favorite-off.svg"; - document.getElementById("btn-favorite-" + id).onclick = () => { - favoriteSong(id); - } - await fetch("/api/removeFavorite.php?i=" + id); - - - location.reload(); - - - window.parent.redownloadFavorites(); - } - let items = Array.from(document.getElementsByClassName("track")).map(i => { return { title: i.getAttribute("data-item-track"), artist: i.getAttribute("data-item-artist"), id: i.id } }); const fuse = new Fuse(items, { diff --git a/app/lyrics.php b/app/lyrics.php index fbdca1d..4a7537d 100644 --- a/app/lyrics.php +++ b/app/lyrics.php @@ -59,7 +59,7 @@
- +
@@ -88,6 +88,10 @@ document.getElementById("not-playing").style.display = "none"; if (!window.lyrics[lastID]) { + window.lyricsLoadTimeout = setTimeout(() => { + location.reload(); + }, 10000); + try { window.lyrics[lastID] = await (await fetch("/api/lyrics.php?id=" + lastID)).json() } catch (e) { @@ -97,6 +101,8 @@ } } + clearTimeout(window.lyricsLoadTimeout); + if (window.lyrics[lastID] && window.lyrics[lastID].payload) { if (window.lyrics[lastID].synced) { document.getElementById("lyrics-synced").style.display = ""; diff --git a/app/modal.php b/app/modal.php new file mode 100644 index 0000000..b939996 --- /dev/null +++ b/app/modal.php @@ -0,0 +1,48 @@ + + + + + + + modal + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/navigation.php b/app/navigation.php index f07c38f..00d1457 100644 --- a/app/navigation.php +++ b/app/navigation.php @@ -51,6 +51,9 @@ + diff --git a/app/player-mobile.php b/app/player-mobile.php index cab8ada..8308eda 100644 --- a/app/player-mobile.php +++ b/app/player-mobile.php @@ -26,7 +26,7 @@
-
+
diff --git a/app/queue.php b/app/queue.php new file mode 100644 index 0000000..86fda0e --- /dev/null +++ b/app/queue.php @@ -0,0 +1,78 @@ + + + + + + + + queue + + + + + + + + + + + +
+
+

Queue

+
+ +
+ + + +

+ + \ No newline at end of file diff --git a/app/search.php b/app/search.php new file mode 100644 index 0000000..2f5f164 --- /dev/null +++ b/app/search.php @@ -0,0 +1,91 @@ + + + + + + + + search + + + + + + + + + + + +
+
+

Search results for ""

+ 0; + }); + + uasort($albums, function ($a, $b) { + return strcmp($a["title"], $b["title"]); + }); + + uasort($albums, function ($a, $b) { + return strcmp($a["artist"], $b["artist"]); + }); + + uasort($albums, function ($a, $b) { + return getMatches($b) - getMatches($a); + }); + + $songs = array_filter($songs, function ($i) { + return getMatches($i) > 0; + }); + + uasort($songs, function ($a, $b) { + return getMatches($b) - getMatches($a); + }); + + ?> + + + +
+ +

+ + \ No newline at end of file diff --git a/app/settings.php b/app/settings.php index 4c2a287..a80fad1 100644 --- a/app/settings.php +++ b/app/settings.php @@ -60,7 +60,7 @@
- Mist version (build ) · © Equestria.dev + Mist version (build ) · © Equestria.dev
diff --git a/assets/.DS_Store b/assets/.DS_Store index eb23c80..5cbb3b6 100644 Binary files a/assets/.DS_Store and b/assets/.DS_Store differ diff --git a/assets/dark.css b/assets/dark.css index e969545..8279657 100644 --- a/assets/dark.css +++ b/assets/dark.css @@ -11,16 +11,16 @@ filter: brightness(0%) invert(1) grayscale(1) !important; } - .navigation-item.active, .navigation-item:active { + div.navigation-item.active, div.navigation-item:active { background-color: rgba(255, 255, 255, .25) !important; } .navigation-item:hover { - background-color: rgba(255, 255, 255, .1); + background-color: rgba(255, 255, 255, .1) !important; } .album:hover { - background-color: rgba(255, 255, 255, .1); + background-color: rgba(255, 255, 255, .1) !important; } #player.bg-white { @@ -32,11 +32,19 @@ } .player-btn:hover { - background-color: rgba(255, 255, 255, .1); + background-color: rgba(255, 255, 255, .1) !important; } .player-btn:active { - background-color: rgba(255, 255, 255, .25); + background-color: rgba(255, 255, 255, .25) !important; + } + + .dropdown-menu { + filter: invert(1) hue-rotate(180deg); + } + + .dropdown-item:hover { + background-color: rgba(0, 0, 0, .25); } .desktop-player #album-art[src="/assets/nothing.svg"] { @@ -52,16 +60,22 @@ color: #666 !important; } - #filter, .list-group-item, .btn, .form-check-input, .link { + #filter, .btn, .form-check-input, .link, .btn-close { filter: invert(1) hue-rotate(180deg); } - .list-group-item img { - filter: invert(1) hue-rotate(180deg); + .list-group-item .icon { + filter: invert(1) !important; } - .list-group-item .icon { - filter: none !important; + .list-group-item { + background: #050505; + color: white; + border-color: #333; + } + + .dropdown-menu.show { + z-index: 999999 !important; } .desktop-player #seekbar-container { @@ -83,4 +97,22 @@ #lyrics-outer #loading { background-color: transparent !important; } + + body.web { + background-color: black !important; + } + + .dropdown-item img { + filter: none !important; + } + + + .modal-header { + border-bottom: 1px solid #353738; + } + + .modal-content { + border: 1px solid rgba(255, 255, 255, .2); + background-color: #111; + } } \ No newline at end of file diff --git a/assets/icons/add.svg b/assets/icons/add.svg new file mode 100644 index 0000000..37cf0c2 --- /dev/null +++ b/assets/icons/add.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/download.svg b/assets/icons/download.svg new file mode 100644 index 0000000..2e1cd9c --- /dev/null +++ b/assets/icons/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/info.svg b/assets/icons/info.svg new file mode 100644 index 0000000..5cd0fe5 --- /dev/null +++ b/assets/icons/info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/menu.svg b/assets/icons/menu.svg new file mode 100644 index 0000000..b182f03 --- /dev/null +++ b/assets/icons/menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/playlist.svg b/assets/icons/playlist.svg index 471d3f2..76c1216 100644 --- a/assets/icons/playlist.svg +++ b/assets/icons/playlist.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/icons/playnext.svg b/assets/icons/playnext.svg new file mode 100644 index 0000000..78824a5 --- /dev/null +++ b/assets/icons/playnext.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/remove.svg b/assets/icons/remove.svg new file mode 100644 index 0000000..e24e387 --- /dev/null +++ b/assets/icons/remove.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/settings.svg b/assets/icons/settings.svg index 759e748..1e37786 100644 --- a/assets/icons/settings.svg +++ b/assets/icons/settings.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/logo-display.ico b/assets/logo-display.ico new file mode 100644 index 0000000..1860aa0 Binary files /dev/null and b/assets/logo-display.ico differ diff --git a/assets/logo-mac.png b/assets/logo-mac.png new file mode 100644 index 0000000..29d8a1e Binary files /dev/null and b/assets/logo-mac.png differ diff --git a/assets/logo.icns b/assets/logo.icns new file mode 100644 index 0000000..f3c9a2d Binary files /dev/null and b/assets/logo.icns differ diff --git a/assets/styles.css b/assets/styles.css index de4d33f..100ea0d 100644 --- a/assets/styles.css +++ b/assets/styles.css @@ -370,7 +370,7 @@ iframe { } #navigation-container { - grid-template-columns: repeat(5, 1fr) !important; + grid-template-columns: repeat(6, 1fr) !important; display: grid !important; margin-top: 2px; } @@ -407,6 +407,14 @@ iframe { } } +@media (min-height: 64px) { + #info-grid-title, #info-grid-info { + position: relative; + top: 5px; + z-index: -1; + } +} + @media (max-width: 823px) { #lyrics-outer, #lyrics-outer * { color: rgba(255, 255, 255, .75); @@ -429,4 +437,12 @@ iframe { #badges { -webkit-app-region: drag; +} + +.dropdown-item:active img { + filter: invert(1); +} + +body.web { + background-color: white; } \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..79c358a --- /dev/null +++ b/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash +cd desktop +#npx electron-packager . Mist --asar --overwrite --platform=darwin --arch=x64 --icon=../assets/logo.icns --out=../build +npx electron-packager . Mist --asar --overwrite --platform=darwin --arch=arm64 --icon=../assets/logo.icns --out=../build +#npx electron-packager . Mist --asar --overwrite --platform=linux --arch=x64 --icon=../assets/logo-display.png --out=../build +#npx electron-packager . Mist --asar --overwrite --platform=linux --arch=arm64 --icon=../assets/logo-display.png --out=../build +npx electron-packager . Mist --asar --overwrite --platform=win32 --arch=x64 --icon=../assets/logo-display.ico --out=../build +#npx electron-packager . Mist --asar --overwrite --platform=win32 --arch=arm64 --icon=../assets/logo-display.ico --out=../build \ No newline at end of file diff --git a/desktop/package.json b/desktop/package.json index 235d0c9..d27d3d7 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -1,4 +1,5 @@ { + "main": "main.js", "dependencies": { "electron": "^27.0.2", "electron-packager": "^17.1.2" diff --git a/icons/maskable.png b/icons/maskable.png index 3b305e0..4bf01ce 100644 Binary files a/icons/maskable.png and b/icons/maskable.png differ diff --git a/icons/maskable.svg b/icons/maskable.svg index aa4f35a..72082a7 100644 --- a/icons/maskable.svg +++ b/icons/maskable.svg @@ -13,62 +13,50 @@ .st7{fill:#4D426A;} .st8{fill:#4B4168;} - + - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/icons/maskable_128x128.png b/icons/maskable_128x128.png index e8d1b33..afaafcb 100644 Binary files a/icons/maskable_128x128.png and b/icons/maskable_128x128.png differ diff --git a/icons/maskable_144x144.png b/icons/maskable_144x144.png index 8865f85..1fcb544 100644 Binary files a/icons/maskable_144x144.png and b/icons/maskable_144x144.png differ diff --git a/icons/maskable_152x152.png b/icons/maskable_152x152.png index b3e939f..c794a43 100644 Binary files a/icons/maskable_152x152.png and b/icons/maskable_152x152.png differ diff --git a/icons/maskable_192x192.png b/icons/maskable_192x192.png index ae21420..f58d220 100644 Binary files a/icons/maskable_192x192.png and b/icons/maskable_192x192.png differ diff --git a/icons/maskable_256x256.png b/icons/maskable_256x256.png index 6e7be53..beb78f5 100644 Binary files a/icons/maskable_256x256.png and b/icons/maskable_256x256.png differ diff --git a/icons/maskable_384x384.png b/icons/maskable_384x384.png index 5979943..0b33b22 100644 Binary files a/icons/maskable_384x384.png and b/icons/maskable_384x384.png differ diff --git a/icons/maskable_64x64.png b/icons/maskable_64x64.png index 74cf23a..b8b8a0b 100644 Binary files a/icons/maskable_64x64.png and b/icons/maskable_64x64.png differ diff --git a/icons/maskable_72x72.png b/icons/maskable_72x72.png index 84f614d..cdc2b62 100644 Binary files a/icons/maskable_72x72.png and b/icons/maskable_72x72.png differ diff --git a/icons/maskable_96x96.png b/icons/maskable_96x96.png index 5e96798..181f238 100644 Binary files a/icons/maskable_96x96.png and b/icons/maskable_96x96.png differ diff --git a/includes/.DS_Store b/includes/.DS_Store index 7969503..d91aeee 100644 Binary files a/includes/.DS_Store and b/includes/.DS_Store differ diff --git a/includes/editor.js b/includes/editor.js new file mode 100644 index 0000000..df0baf3 --- /dev/null +++ b/includes/editor.js @@ -0,0 +1,193 @@ +const prompts = require('prompts'); +const songs = require('../assets/content/songs.json'); +const albums = require('../assets/content/albums.json'); +const fs = require("fs"); +const path = require("path"); +const chalk = require("chalk"); +const Fuse = require("fuse.js"); + +function reload() { + for (let songID of Object.keys(songs)) { + if (fs.existsSync("/opt/mist")) { + if (!fs.existsSync("/opt/mist/flac/" + songID + ".flac") || !fs.existsSync("/opt/mist/aac/" + songID + ".m4a") || !fs.existsSync("/opt/mist/jpeg/" + songID + ".jpg")) { + delete songs[songID]; + } + } else { + if (!fs.existsSync("../assets/content/" + songID + ".flac") || !fs.existsSync("../assets/content/" + songID + ".m4a") || !fs.existsSync("../assets/content/" + songID + ".jpg")) { + delete songs[songID]; + } + } + } + + let idList = [...Object.keys(songs), ...Object.keys(albums)]; + + if (fs.existsSync("/opt/mist")) { + for (let file of fs.readdirSync("/opt/mist/flac")) { + if (fs.lstatSync("/opt/mist/flac/" + file).isFile()) { + let id = path.basename(file, path.extname(file)); + + if (!idList.includes(id) && !file.endsWith(".json")) { + fs.unlinkSync("/opt/mist/flac/" + file); + if (fs.existsSync("../assets/content/" + file)) fs.unlinkSync("../assets/content/" + file); + } else { + if (!fs.existsSync("../assets/content/" + file)) fs.symlinkSync("/opt/mist/flac/" + file, "../assets/content/" + file); + } + } + } + + for (let file of fs.readdirSync("/opt/mist/aac")) { + if (fs.lstatSync("/opt/mist/aac/" + file).isFile()) { + let id = path.basename(file, path.extname(file)); + + if (!idList.includes(id) && !file.endsWith(".json")) { + fs.unlinkSync("/opt/mist/aac/" + file); + if (fs.existsSync("../assets/content/" + file)) fs.unlinkSync("../assets/content/" + file); + } else { + if (!fs.existsSync("../assets/content/" + file)) fs.symlinkSync("/opt/mist/aac/" + file, "../assets/content/" + file); + } + } + } + + for (let file of fs.readdirSync("/opt/mist/jpeg")) { + if (fs.lstatSync("/opt/mist/jpeg/" + file).isFile()) { + let id = path.basename(file, path.extname(file)); + + if (!idList.includes(id) && !file.endsWith(".json")) { + fs.unlinkSync("/opt/mist/jpeg/" + file); + if (fs.existsSync("../assets/content/" + file)) fs.unlinkSync("../assets/content/" + file); + } else { + if (!fs.existsSync("../assets/content/" + file)) fs.symlinkSync("/opt/mist/jpeg/" + file, "../assets/content/" + file); + } + } + } + } else { + for (let file of fs.readdirSync("../assets/content")) { + if (fs.lstatSync("../assets/content/" + file).isFile()) { + let id = path.basename(file, path.extname(file)); + + if (!idList.includes(id) && !file.endsWith(".json")) { + fs.unlinkSync("../assets/content/" + file); + } + } + } + } + + for (let albumID of Object.keys(albums)) { + let album = albums[albumID]; + album["tracks"] = [...new Set(album["tracks"])].sort((a, b) => { + return songs[a]['track'] - songs[b]['track']; + }); + } + + fs.writeFileSync("../assets/content/songs.json", JSON.stringify(songs)); + fs.writeFileSync("../assets/content/albums.json", JSON.stringify(albums)); +} + +reload(); + +console.log(chalk.bold("Mist metadata editor") + "\n"); + +const fuse = new Fuse([...Object.entries(songs).map(i => { + j = i[1]; + j['_type'] = "song"; + j['_id'] = i[0]; + return j; +}), ...Object.entries(albums).map(i => { + j = i[1]; + j['_type'] = "album"; + j['_id'] = i[0]; + return j; +})], { + keys: ['title', 'artist'] +}); + +async function main() { + console.clear(); + const response = await prompts({ + type: 'text', + name: 'search', + message: 'Enter the name of a song or album:' + }); + + if (!response['search']) { + return; + } + + let query = response['search']; + let results = fuse.search(query); + let items = []; + + for (let result of results) { + items.push({ + title: chalk.cyan(result.item._type === "song" ? "Song: " : "Album: ") + result.item.artist + " - " + result.item.title, + value: result.item._type + ":" + result.item._id + }) + } + + const select = await prompts({ + type: 'select', + name: 'choice', + message: 'Select a song or album in the list.', + choices: items + }); + + if (!select['choice']) { + return; + } + + await item(select['choice']); +} + +async function item(meta) { + console.clear(); + let id = meta.split(":")[1]; + let type = meta.split(":")[0]; + let item; + + if (type === "song") item = songs[id]; + if (type === "album") item = albums[id]; + + let options = [ + { title: "ID: " + id, value: "", disabled: true }, + { title: chalk.gray("Back"), value: "back" }, + ]; + + options.push({ title: chalk.red("Delete"), value: "delete" }); + + const select = await prompts({ + type: 'select', + name: 'choice', + message: chalk.cyan(type === "song" ? "Song: " : "Album: ") + item.artist + " - " + item.title, + choices: options + }); + + if (!select['choice']) { + return; + } + + if (select['choice'] === "back") { + main(); + return; + } + + if (select['choice'] === "delete") { + let confirm = await prompts({ + type: 'confirm', + name: 'confirm', + message: 'Are you sure you want to delete this ' + type + '? This is permanent and will affect users.' + }); + + if (typeof confirm['confirm'] !== "boolean") { + return; + } else { + if (confirm['confirm']) { + // TODO: Delete + main(); + } else { + + } + } + } +} + +main(); \ No newline at end of file diff --git a/includes/node_modules/.package-lock.json b/includes/node_modules/.package-lock.json index 23f9a60..4a34ccd 100644 --- a/includes/node_modules/.package-lock.json +++ b/includes/node_modules/.package-lock.json @@ -3,6 +3,75 @@ "lockfileVersion": 3, "requires": true, "packages": { + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/fuse.js": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.0.0.tgz", + "integrity": "sha512-14F4hBIxqKvD4Zz/XjDc3y94mNZN6pRv3U13Udo0lNLCWRBUsrMv2xwcF/y/Z5sV6+FQW+/ow68cHpm4sunt8Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "engines": { + "node": ">=6" + } + }, "node_modules/node-watch": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.4.tgz", @@ -10,6 +79,34 @@ "engines": { "node": ">=6" } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } } } } diff --git a/includes/node_modules/ansi-styles/index.d.ts b/includes/node_modules/ansi-styles/index.d.ts new file mode 100644 index 0000000..44a907e --- /dev/null +++ b/includes/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,345 @@ +declare type CSSColor = + | 'aliceblue' + | 'antiquewhite' + | 'aqua' + | 'aquamarine' + | 'azure' + | 'beige' + | 'bisque' + | 'black' + | 'blanchedalmond' + | 'blue' + | 'blueviolet' + | 'brown' + | 'burlywood' + | 'cadetblue' + | 'chartreuse' + | 'chocolate' + | 'coral' + | 'cornflowerblue' + | 'cornsilk' + | 'crimson' + | 'cyan' + | 'darkblue' + | 'darkcyan' + | 'darkgoldenrod' + | 'darkgray' + | 'darkgreen' + | 'darkgrey' + | 'darkkhaki' + | 'darkmagenta' + | 'darkolivegreen' + | 'darkorange' + | 'darkorchid' + | 'darkred' + | 'darksalmon' + | 'darkseagreen' + | 'darkslateblue' + | 'darkslategray' + | 'darkslategrey' + | 'darkturquoise' + | 'darkviolet' + | 'deeppink' + | 'deepskyblue' + | 'dimgray' + | 'dimgrey' + | 'dodgerblue' + | 'firebrick' + | 'floralwhite' + | 'forestgreen' + | 'fuchsia' + | 'gainsboro' + | 'ghostwhite' + | 'gold' + | 'goldenrod' + | 'gray' + | 'green' + | 'greenyellow' + | 'grey' + | 'honeydew' + | 'hotpink' + | 'indianred' + | 'indigo' + | 'ivory' + | 'khaki' + | 'lavender' + | 'lavenderblush' + | 'lawngreen' + | 'lemonchiffon' + | 'lightblue' + | 'lightcoral' + | 'lightcyan' + | 'lightgoldenrodyellow' + | 'lightgray' + | 'lightgreen' + | 'lightgrey' + | 'lightpink' + | 'lightsalmon' + | 'lightseagreen' + | 'lightskyblue' + | 'lightslategray' + | 'lightslategrey' + | 'lightsteelblue' + | 'lightyellow' + | 'lime' + | 'limegreen' + | 'linen' + | 'magenta' + | 'maroon' + | 'mediumaquamarine' + | 'mediumblue' + | 'mediumorchid' + | 'mediumpurple' + | 'mediumseagreen' + | 'mediumslateblue' + | 'mediumspringgreen' + | 'mediumturquoise' + | 'mediumvioletred' + | 'midnightblue' + | 'mintcream' + | 'mistyrose' + | 'moccasin' + | 'navajowhite' + | 'navy' + | 'oldlace' + | 'olive' + | 'olivedrab' + | 'orange' + | 'orangered' + | 'orchid' + | 'palegoldenrod' + | 'palegreen' + | 'paleturquoise' + | 'palevioletred' + | 'papayawhip' + | 'peachpuff' + | 'peru' + | 'pink' + | 'plum' + | 'powderblue' + | 'purple' + | 'rebeccapurple' + | 'red' + | 'rosybrown' + | 'royalblue' + | 'saddlebrown' + | 'salmon' + | 'sandybrown' + | 'seagreen' + | 'seashell' + | 'sienna' + | 'silver' + | 'skyblue' + | 'slateblue' + | 'slategray' + | 'slategrey' + | 'snow' + | 'springgreen' + | 'steelblue' + | 'tan' + | 'teal' + | 'thistle' + | 'tomato' + | 'turquoise' + | 'violet' + | 'wheat' + | 'white' + | 'whitesmoke' + | 'yellow' + | 'yellowgreen'; + +declare namespace ansiStyles { + interface ColorConvert { + /** + The RGB color space. + + @param red - (`0`-`255`) + @param green - (`0`-`255`) + @param blue - (`0`-`255`) + */ + rgb(red: number, green: number, blue: number): string; + + /** + The RGB HEX color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hex(hex: string): string; + + /** + @param keyword - A CSS color name. + */ + keyword(keyword: CSSColor): string; + + /** + The HSL color space. + + @param hue - (`0`-`360`) + @param saturation - (`0`-`100`) + @param lightness - (`0`-`100`) + */ + hsl(hue: number, saturation: number, lightness: number): string; + + /** + The HSV color space. + + @param hue - (`0`-`360`) + @param saturation - (`0`-`100`) + @param value - (`0`-`100`) + */ + hsv(hue: number, saturation: number, value: number): string; + + /** + The HSV color space. + + @param hue - (`0`-`360`) + @param whiteness - (`0`-`100`) + @param blackness - (`0`-`100`) + */ + hwb(hue: number, whiteness: number, blackness: number): string; + + /** + Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color. + */ + ansi(ansi: number): string; + + /** + Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. + */ + ansi256(ansi: number): string; + } + + interface CSPair { + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; + } + + interface ColorBase { + readonly ansi: ColorConvert; + readonly ansi256: ColorConvert; + readonly ansi16m: ColorConvert; + + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + } + + interface Modifier { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; + } + + interface ForegroundColor { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; + } + + interface BackgroundColor { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; + } +} + +declare const ansiStyles: { + readonly modifier: ansiStyles.Modifier; + readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; + readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; + readonly codes: ReadonlyMap; +} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier; + +export = ansiStyles; diff --git a/includes/node_modules/ansi-styles/index.js b/includes/node_modules/ansi-styles/index.js new file mode 100644 index 0000000..5d82581 --- /dev/null +++ b/includes/node_modules/ansi-styles/index.js @@ -0,0 +1,163 @@ +'use strict'; + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = require('color-convert'); + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/includes/node_modules/ansi-styles/license b/includes/node_modules/ansi-styles/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/includes/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/includes/node_modules/ansi-styles/package.json b/includes/node_modules/ansi-styles/package.json new file mode 100644 index 0000000..7539328 --- /dev/null +++ b/includes/node_modules/ansi-styles/package.json @@ -0,0 +1,56 @@ +{ + "name": "ansi-styles", + "version": "4.3.0", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "color-convert": "^2.0.1" + }, + "devDependencies": { + "@types/color-convert": "^1.9.0", + "ava": "^2.3.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.11.0", + "xo": "^0.25.3" + } +} diff --git a/includes/node_modules/ansi-styles/readme.md b/includes/node_modules/ansi-styles/readme.md new file mode 100644 index 0000000..24883de --- /dev/null +++ b/includes/node_modules/ansi-styles/readme.md @@ -0,0 +1,152 @@ +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + + + +## Install + +``` +$ npm install ansi-styles +``` + +## Usage + +```js +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); + + +// Color conversion between 16/256/truecolor +// NOTE: If conversion goes to 16 colors or 256 colors, the original color +// may be degraded to fit that color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); +console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close); +``` + +## API + +Each style has an `open` and `close` property. + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example + +```js +console.log(style.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +console.log(style.codes.get(36)); +//=> 39 +``` + +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. + +The following color spaces from `color-convert` are supported: + +- `rgb` +- `hex` +- `keyword` +- `hsl` +- `hsv` +- `hwb` +- `ansi` +- `ansi256` + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code + +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code + +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/includes/node_modules/chalk/index.d.ts b/includes/node_modules/chalk/index.d.ts new file mode 100644 index 0000000..9cd88f3 --- /dev/null +++ b/includes/node_modules/chalk/index.d.ts @@ -0,0 +1,415 @@ +/** +Basic foreground colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type ForegroundColor = + | 'black' + | 'red' + | 'green' + | 'yellow' + | 'blue' + | 'magenta' + | 'cyan' + | 'white' + | 'gray' + | 'grey' + | 'blackBright' + | 'redBright' + | 'greenBright' + | 'yellowBright' + | 'blueBright' + | 'magentaBright' + | 'cyanBright' + | 'whiteBright'; + +/** +Basic background colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type BackgroundColor = + | 'bgBlack' + | 'bgRed' + | 'bgGreen' + | 'bgYellow' + | 'bgBlue' + | 'bgMagenta' + | 'bgCyan' + | 'bgWhite' + | 'bgGray' + | 'bgGrey' + | 'bgBlackBright' + | 'bgRedBright' + | 'bgGreenBright' + | 'bgYellowBright' + | 'bgBlueBright' + | 'bgMagentaBright' + | 'bgCyanBright' + | 'bgWhiteBright'; + +/** +Basic colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type Color = ForegroundColor | BackgroundColor; + +declare type Modifiers = + | 'reset' + | 'bold' + | 'dim' + | 'italic' + | 'underline' + | 'inverse' + | 'hidden' + | 'strikethrough' + | 'visible'; + +declare namespace chalk { + /** + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + type Level = 0 | 1 | 2 | 3; + + interface Options { + /** + Specify the color support for Chalk. + + By default, color support is automatically detected based on the environment. + + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + level?: Level; + } + + /** + Return a new Chalk instance. + */ + type Instance = new (options?: Options) => Chalk; + + /** + Detect whether the terminal supports color. + */ + interface ColorSupport { + /** + The color level used by Chalk. + */ + level: Level; + + /** + Return whether Chalk supports basic 16 colors. + */ + hasBasic: boolean; + + /** + Return whether Chalk supports ANSI 256 colors. + */ + has256: boolean; + + /** + Return whether Chalk supports Truecolor 16 million colors. + */ + has16m: boolean; + } + + interface ChalkFunction { + /** + Use a template string. + + @remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341)) + + @example + ``` + import chalk = require('chalk'); + + log(chalk` + CPU: {red ${cpu.totalPercent}%} + RAM: {green ${ram.used / ram.total * 100}%} + DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} + `); + ``` + + @example + ``` + import chalk = require('chalk'); + + log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`) + ``` + */ + (text: TemplateStringsArray, ...placeholders: unknown[]): string; + + (...text: unknown[]): string; + } + + interface Chalk extends ChalkFunction { + /** + Return a new Chalk instance. + */ + Instance: Instance; + + /** + The color support for Chalk. + + By default, color support is automatically detected based on the environment. + + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + level: Level; + + /** + Use HEX value to set text color. + + @param color - Hexadecimal value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.hex('#DEADED'); + ``` + */ + hex(color: string): Chalk; + + /** + Use keyword color value to set text color. + + @param color - Keyword value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.keyword('orange'); + ``` + */ + keyword(color: string): Chalk; + + /** + Use RGB values to set text color. + */ + rgb(red: number, green: number, blue: number): Chalk; + + /** + Use HSL values to set text color. + */ + hsl(hue: number, saturation: number, lightness: number): Chalk; + + /** + Use HSV values to set text color. + */ + hsv(hue: number, saturation: number, value: number): Chalk; + + /** + Use HWB values to set text color. + */ + hwb(hue: number, whiteness: number, blackness: number): Chalk; + + /** + Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color. + + 30 <= code && code < 38 || 90 <= code && code < 98 + For example, 31 for red, 91 for redBright. + */ + ansi(code: number): Chalk; + + /** + Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. + */ + ansi256(index: number): Chalk; + + /** + Use HEX value to set background color. + + @param color - Hexadecimal value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.bgHex('#DEADED'); + ``` + */ + bgHex(color: string): Chalk; + + /** + Use keyword color value to set background color. + + @param color - Keyword value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.bgKeyword('orange'); + ``` + */ + bgKeyword(color: string): Chalk; + + /** + Use RGB values to set background color. + */ + bgRgb(red: number, green: number, blue: number): Chalk; + + /** + Use HSL values to set background color. + */ + bgHsl(hue: number, saturation: number, lightness: number): Chalk; + + /** + Use HSV values to set background color. + */ + bgHsv(hue: number, saturation: number, value: number): Chalk; + + /** + Use HWB values to set background color. + */ + bgHwb(hue: number, whiteness: number, blackness: number): Chalk; + + /** + Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color. + + 30 <= code && code < 38 || 90 <= code && code < 98 + For example, 31 for red, 91 for redBright. + Use the foreground code, not the background code (for example, not 41, nor 101). + */ + bgAnsi(code: number): Chalk; + + /** + Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color. + */ + bgAnsi256(index: number): Chalk; + + /** + Modifier: Resets the current color chain. + */ + readonly reset: Chalk; + + /** + Modifier: Make text bold. + */ + readonly bold: Chalk; + + /** + Modifier: Emitting only a small amount of light. + */ + readonly dim: Chalk; + + /** + Modifier: Make text italic. (Not widely supported) + */ + readonly italic: Chalk; + + /** + Modifier: Make text underline. (Not widely supported) + */ + readonly underline: Chalk; + + /** + Modifier: Inverse background and foreground colors. + */ + readonly inverse: Chalk; + + /** + Modifier: Prints the text, but makes it invisible. + */ + readonly hidden: Chalk; + + /** + Modifier: Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: Chalk; + + /** + Modifier: Prints the text only when Chalk has a color support level > 0. + Can be useful for things that are purely cosmetic. + */ + readonly visible: Chalk; + + readonly black: Chalk; + readonly red: Chalk; + readonly green: Chalk; + readonly yellow: Chalk; + readonly blue: Chalk; + readonly magenta: Chalk; + readonly cyan: Chalk; + readonly white: Chalk; + + /* + Alias for `blackBright`. + */ + readonly gray: Chalk; + + /* + Alias for `blackBright`. + */ + readonly grey: Chalk; + + readonly blackBright: Chalk; + readonly redBright: Chalk; + readonly greenBright: Chalk; + readonly yellowBright: Chalk; + readonly blueBright: Chalk; + readonly magentaBright: Chalk; + readonly cyanBright: Chalk; + readonly whiteBright: Chalk; + + readonly bgBlack: Chalk; + readonly bgRed: Chalk; + readonly bgGreen: Chalk; + readonly bgYellow: Chalk; + readonly bgBlue: Chalk; + readonly bgMagenta: Chalk; + readonly bgCyan: Chalk; + readonly bgWhite: Chalk; + + /* + Alias for `bgBlackBright`. + */ + readonly bgGray: Chalk; + + /* + Alias for `bgBlackBright`. + */ + readonly bgGrey: Chalk; + + readonly bgBlackBright: Chalk; + readonly bgRedBright: Chalk; + readonly bgGreenBright: Chalk; + readonly bgYellowBright: Chalk; + readonly bgBlueBright: Chalk; + readonly bgMagentaBright: Chalk; + readonly bgCyanBright: Chalk; + readonly bgWhiteBright: Chalk; + } +} + +/** +Main Chalk object that allows to chain styles together. +Call the last one as a method with a string argument. +Order doesn't matter, and later styles take precedent in case of a conflict. +This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. +*/ +declare const chalk: chalk.Chalk & chalk.ChalkFunction & { + supportsColor: chalk.ColorSupport | false; + Level: chalk.Level; + Color: Color; + ForegroundColor: ForegroundColor; + BackgroundColor: BackgroundColor; + Modifiers: Modifiers; + stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false}; +}; + +export = chalk; diff --git a/includes/node_modules/chalk/license b/includes/node_modules/chalk/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/includes/node_modules/chalk/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/includes/node_modules/chalk/package.json b/includes/node_modules/chalk/package.json new file mode 100644 index 0000000..47c23f2 --- /dev/null +++ b/includes/node_modules/chalk/package.json @@ -0,0 +1,68 @@ +{ + "name": "chalk", + "version": "4.1.2", + "description": "Terminal string styling done right", + "license": "MIT", + "repository": "chalk/chalk", + "funding": "https://github.com/chalk/chalk?sponsor=1", + "main": "source", + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && nyc ava && tsd", + "bench": "matcha benchmark.js" + }, + "files": [ + "source", + "index.d.ts" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "str", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "devDependencies": { + "ava": "^2.4.0", + "coveralls": "^3.0.7", + "execa": "^4.0.0", + "import-fresh": "^3.1.0", + "matcha": "^0.7.0", + "nyc": "^15.0.0", + "resolve-from": "^5.0.0", + "tsd": "^0.7.4", + "xo": "^0.28.2" + }, + "xo": { + "rules": { + "unicorn/prefer-string-slice": "off", + "unicorn/prefer-includes": "off", + "@typescript-eslint/member-ordering": "off", + "no-redeclare": "off", + "unicorn/string-content": "off", + "unicorn/better-regex": "off" + } + } +} diff --git a/includes/node_modules/chalk/readme.md b/includes/node_modules/chalk/readme.md new file mode 100644 index 0000000..a055d21 --- /dev/null +++ b/includes/node_modules/chalk/readme.md @@ -0,0 +1,341 @@ +

+
+
+ Chalk +
+
+
+

+ +> Terminal string styling done right + +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk) + + + +
+ +--- + + + +--- + +
+ +## Highlights + +- Expressive API +- Highly performant +- Ability to nest styles +- [256/Truecolor color support](#256-and-truecolor-color-support) +- Auto-detects color support +- Doesn't extend `String.prototype` +- Clean and focused +- Actively maintained +- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020 + +## Install + +```console +$ npm install chalk +``` + +## Usage + +```js +const chalk = require('chalk'); + +console.log(chalk.blue('Hello world!')); +``` + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +const chalk = require('chalk'); +const log = console.log; + +// Combine styled and normal strings +log(chalk.blue('Hello') + ' World' + chalk.red('!')); + +// Compose multiple styles using the chainable API +log(chalk.blue.bgRed.bold('Hello world!')); + +// Pass in multiple arguments +log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); + +// Nest styles +log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); + +// Nest styles of the same type even (color, underline, background) +log(chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +)); + +// ES2015 template literal +log(` +CPU: ${chalk.red('90%')} +RAM: ${chalk.green('40%')} +DISK: ${chalk.yellow('70%')} +`); + +// ES2015 tagged template literal +log(chalk` +CPU: {red ${cpu.totalPercent}%} +RAM: {green ${ram.used / ram.total * 100}%} +DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} +`); + +// Use RGB colors in terminal emulators that support it. +log(chalk.keyword('orange')('Yay for orange colored text!')); +log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); +log(chalk.hex('#DEADED').bold('Bold gray!')); +``` + +Easily define your own themes: + +```js +const chalk = require('chalk'); + +const error = chalk.bold.red; +const warning = chalk.keyword('orange'); + +console.log(error('Error!')); +console.log(warning('Warning!')); +``` + +Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): + +```js +const name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> 'Hello Sindre' +``` + +## API + +### chalk.`