diff --git a/flake-parts/astro.nix b/flake-parts/astro.nix deleted file mode 100644 index 41ce9f4..0000000 --- a/flake-parts/astro.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - inputs, - self, - ... -} @ part-inputs: { - imports = []; - - perSystem = { - config, - pkgs, - lib, - system, - inputs', - self', - ... - }: let - inherit (inputs.nix-filter.lib) filter inDirectory matchExt; - in rec { - packages = { - inherit (pkgs) nodejs yarn; - - inherit (config.dream2nix.outputs.web.packages) web; - }; - - dream2nix.inputs.web = { - source = filter { - root = ../web; - include = [ - "yarn.lock" - (inDirectory "src") - (inDirectory "public") - (matchExt "js") - (matchExt "json") - (matchExt "ts") - (matchExt "cjs") - (matchExt "mjs") - ]; - }; - - projects.web = { - subsystem = "nodejs"; - translator = "yarn-lock"; - }; - - packageOverrides.web = { - # Instead of packaging the library, only package the final build - copySite = { - installPhase = '' - mkdir -p $out - cp -r ./dist/* $out - ''; - }; - }; - }; - }; -} diff --git a/flake-parts/shells.nix b/flake-parts/shells.nix index fb3cf3d..674c398 100644 --- a/flake-parts/shells.nix +++ b/flake-parts/shells.nix @@ -21,9 +21,6 @@ # version control pkgs.cocogitto inputs'.bomper.packages.cli - # nodejs - self'.packages.nodejs - self'.packages.yarn # formatting self'.packages.treefmt ]; diff --git a/flake.lock b/flake.lock index 467815f..1c1fcc5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,22 +1,5 @@ { "nodes": { - "all-cabal-json": { - "flake": false, - "locked": { - "lastModified": 1665552503, - "narHash": "sha256-r14RmRSwzv5c+bWKUDaze6pXM7nOsiz1H8nvFHJvufc=", - "owner": "nix-community", - "repo": "all-cabal-json", - "rev": "d7c0434eebffb305071404edcf9d5cd99703878e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "hackage", - "repo": "all-cabal-json", - "type": "github" - } - }, "bomper": { "inputs": { "bomper": "bomper_2", @@ -142,104 +125,6 @@ "type": "github" } }, - "crane_3": { - "flake": false, - "locked": { - "lastModified": 1670900067, - "narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=", - "owner": "ipetkov", - "repo": "crane", - "rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "devshell": { - "flake": false, - "locked": { - "lastModified": 1663445644, - "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", - "owner": "numtide", - "repo": "devshell", - "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "dream2nix": { - "inputs": { - "all-cabal-json": "all-cabal-json", - "crane": "crane_3", - "devshell": "devshell", - "drv-parts": "drv-parts", - "flake-compat": "flake-compat_3", - "flake-parts": [ - "flake-parts" - ], - "flake-utils-pre-commit": "flake-utils-pre-commit", - "ghc-utils": "ghc-utils", - "gomod2nix": "gomod2nix", - "mach-nix": "mach-nix", - "nix-pypi-fetcher": "nix-pypi-fetcher", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgsV1": "nixpkgsV1", - "poetry2nix": "poetry2nix", - "pre-commit-hooks": "pre-commit-hooks_4", - "pruned-racket-catalog": "pruned-racket-catalog" - }, - "locked": { - "lastModified": 1679826487, - "narHash": "sha256-zu9va5GEMzEQoT9e1ObdzdxBFxaK2yY++TOvrp7rYlM=", - "owner": "nix-community", - "repo": "dream2nix", - "rev": "76863ca023a94171924963d3d23d04fdd758d41e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "dream2nix", - "type": "github" - } - }, - "drv-parts": { - "inputs": { - "flake-compat": [ - "dream2nix", - "flake-compat" - ], - "flake-parts": [ - "dream2nix", - "flake-parts" - ], - "nixpkgs": [ - "dream2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1679631398, - "narHash": "sha256-LmA1XEzVoJhtLA6GLuMTrnYM0/2piTxdWxKXCVLiaxw=", - "owner": "davhau", - "repo": "drv-parts", - "rev": "2544be2a9e7c8f347a3af98ba0298f2ee9d3f0fa", - "type": "github" - }, - "original": { - "owner": "davhau", - "repo": "drv-parts", - "type": "github" - } - }, "fenix": { "inputs": { "nixpkgs": [ @@ -331,22 +216,6 @@ "type": "github" } }, - "flake-compat_4": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs": [ @@ -423,21 +292,6 @@ "type": "github" } }, - "flake-utils-pre-commit": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "flake-utils_10": { "locked": { "lastModified": 1667395993, @@ -605,22 +459,6 @@ "type": "github" } }, - "ghc-utils": { - "flake": false, - "locked": { - "lastModified": 1662774800, - "narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=", - "ref": "refs/heads/master", - "rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea", - "revCount": 1072, - "type": "git", - "url": "https://gitlab.haskell.org/bgamari/ghc-utils" - }, - "original": { - "type": "git", - "url": "https://gitlab.haskell.org/bgamari/ghc-utils" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -687,37 +525,6 @@ "type": "github" } }, - "gomod2nix": { - "flake": false, - "locked": { - "lastModified": 1627572165, - "narHash": "sha256-MFpwnkvQpauj799b4QTBJQFEddbD02+Ln5k92QyHOSk=", - "owner": "tweag", - "repo": "gomod2nix", - "rev": "67f22dd738d092c6ba88e420350ada0ed4992ae8", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "gomod2nix", - "type": "github" - } - }, - "mach-nix": { - "flake": false, - "locked": { - "lastModified": 1634711045, - "narHash": "sha256-m5A2Ty88NChLyFhXucECj6+AuiMZPHXNbw+9Kcs7F6Y=", - "owner": "DavHau", - "repo": "mach-nix", - "rev": "4433f74a97b94b596fa6cd9b9c0402104aceef5d", - "type": "github" - }, - "original": { - "id": "mach-nix", - "type": "indirect" - } - }, "nix-filter": { "locked": { "lastModified": 1666547822, @@ -733,22 +540,6 @@ "type": "github" } }, - "nix-pypi-fetcher": { - "flake": false, - "locked": { - "lastModified": 1669065297, - "narHash": "sha256-UStjXjNIuIm7SzMOWvuYWIHBkPUKQ8Id63BMJjnIDoA=", - "owner": "DavHau", - "repo": "nix-pypi-fetcher", - "rev": "a9885ac6a091576b5195d547ac743d45a2a615ac", - "type": "github" - }, - "original": { - "owner": "DavHau", - "repo": "nix-pypi-fetcher", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1645655918, @@ -797,21 +588,6 @@ "type": "github" } }, - "nixpkgsV1": { - "locked": { - "lastModified": 1678500271, - "narHash": "sha256-tRBLElf6f02HJGG0ZR7znMNFv/Uf7b2fFInpTHiHaSE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5eb98948b66de29f899c7fe27ae112a47964baf8", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-22.11", - "type": "indirect" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1645655918, @@ -855,23 +631,6 @@ "type": "indirect" } }, - "poetry2nix": { - "flake": false, - "locked": { - "lastModified": 1666918719, - "narHash": "sha256-BkK42fjAku+2WgCOv2/1NrPa754eQPV7gPBmoKQBWlc=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "289efb187123656a116b915206e66852f038720e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "1.36.0", - "repo": "poetry2nix", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-utils": "flake-utils_2", @@ -931,32 +690,7 @@ }, "pre-commit-hooks_4": { "inputs": { - "flake-utils": [ - "dream2nix", - "flake-utils-pre-commit" - ], - "nixpkgs": [ - "dream2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1646153636, - "narHash": "sha256-AlWHMzK+xJ1mG267FdT8dCq/HvLCA6jwmx2ZUy5O8tY=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "pre-commit-hooks_5": { - "inputs": { - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_3", "flake-utils": "flake-utils_12", "gitignore": "gitignore_3", "nixpkgs": [ @@ -978,34 +712,16 @@ "type": "github" } }, - "pruned-racket-catalog": { - "flake": false, - "locked": { - "lastModified": 1672537287, - "narHash": "sha256-SuOvXVcLfakw18oJB/PuRMyvGyGG1+CQD3R+TGHIv44=", - "owner": "nix-community", - "repo": "pruned-racket-catalog", - "rev": "c8b89557fb53b36efa2ee48a769c7364df0f6262", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "catalog", - "repo": "pruned-racket-catalog", - "type": "github" - } - }, "root": { "inputs": { "bomper": "bomper", "crane": "crane_2", - "dream2nix": "dream2nix", "fenix": "fenix_2", "flake-parts": "flake-parts_3", "flake-utils": "flake-utils_11", "nix-filter": "nix-filter", "nixpkgs": "nixpkgs_4", - "pre-commit-hooks": "pre-commit-hooks_5" + "pre-commit-hooks": "pre-commit-hooks_4" } }, "rust-analyzer-src": { diff --git a/flake.nix b/flake.nix index bb41770..0964075 100644 --- a/flake.nix +++ b/flake.nix @@ -21,11 +21,6 @@ url = "github:justinrubek/bomper"; inputs.nixpkgs.follows = "nixpkgs"; }; - dream2nix = { - url = "github:nix-community/dream2nix"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-parts.follows = "flake-parts"; - }; }; outputs = inputs @ { @@ -37,9 +32,6 @@ flake-parts.lib.mkFlake {inherit inputs;} { systems = ["x86_64-linux" "aarch64-linux"]; imports = [ - ./flake-parts/astro.nix - inputs.dream2nix.flakeModuleBeta - ./flake-parts/web.nix ./flake-parts/rust-toolchain.nix diff --git a/web/.env.development b/web/.env.development deleted file mode 100644 index 98214b7..0000000 --- a/web/.env.development +++ /dev/null @@ -1 +0,0 @@ -PUBLIC_SCHEDULE_API_URL=http://eunomia:8000 diff --git a/web/.gitignore b/web/.gitignore deleted file mode 100644 index 7329a85..0000000 --- a/web/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# build output -dist/ -.output/ - -# dependencies -node_modules/ - -# logs -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* - - -# environment variables -.env -.env.production - -# macOS-specific files -.DS_Store diff --git a/web/.npmrc b/web/.npmrc deleted file mode 100644 index d8fbb42..0000000 --- a/web/.npmrc +++ /dev/null @@ -1 +0,0 @@ -@justinrubek:registry=https://npm.pkg.github.com diff --git a/web/astro.config.mjs b/web/astro.config.mjs deleted file mode 100644 index 54b9a3c..0000000 --- a/web/astro.config.mjs +++ /dev/null @@ -1,65 +0,0 @@ -import mdx from '@astrojs/mdx' -import svelte from '@astrojs/svelte' -import sitemap from '@astrojs/sitemap' -import tailwind from '@astrojs/tailwind' -import path, { dirname } from 'path' -import { fileURLToPath } from 'url' - -const __filename = fileURLToPath(import.meta.url) -const __dirname = dirname(__filename) - -// Full Astro Configuration API Documentation: -// https://docs.astro.build/reference/configuration-reference -// - -import remarkHintPlugin from "remark-hint" -import remarkHtmlPlugin from "remark-html" - -const mdxOptions = { - remarkPlugins: [ - remarkHintPlugin, - remarkHtmlPlugin, - ], -}; - -// @type-check enabled! -// @ts-check -export default /** @type {import('astro').AstroUserConfig} */ ({ - // root: '.', - // outDir: './dist', - // publicDir: './public', - - site: 'https://rubek.dev', - server: { - // port: 3000, - }, - integrations: [ - mdx(mdxOptions), - svelte(), - tailwind({ - config: { - applyBaseStyles: false - }, - }), - sitemap() - ], - vite: { - plugins: [], - resolve: { - alias: { - '$': path.resolve(__dirname, './src'), - }, - }, - optimizeDeps: { - allowNodeBuiltins: true - }, - server: { - proxy: { - '/api': { - target: 'http://127.0.0.1:3000', - changeOrigin: true, - }, - }, - }, - } -}); diff --git a/web/package.json b/web/package.json deleted file mode 100644 index 973fb22..0000000 --- a/web/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "annapurna", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "astro dev", - "start": "astro dev", - "build": "astro build", - "check": "astro check", - "preview": "astro preview" - }, - "devDependencies": { - "@astrojs/mdx": "^0.12.1", - "@astrojs/rss": "^1.0.3", - "@astrojs/sitemap": "^1.0.0", - "@astrojs/svelte": "^1.0.2", - "@astrojs/tailwind": "^2.1.3", - "@fontsource/fira-sans": "^4.5.9", - "@rubekpkgs/date-picker-svelte": "^2.3.0-dev2", - "@tailwindcss/aspect-ratio": "^0.4.0", - "@tailwindcss/forms": "^0.5.0", - "@tailwindcss/line-clamp": "^0.4.2", - "@tailwindcss/typography": "^0.5.2", - "@types/node": "^18.7.14", - "astro": "^1.6.13", - "dayjs": "^1.11.7", - "globby": "^13.1.2", - "gray-matter": "^4.0.3", - "lunr": "^2.3.9", - "mdx": "^0.3.1", - "svelte": "^3.50.0", - "svelte-forms-lib": "^2.0.1", - "tailwindcss": "^3.0.24", - "typescript": "^4.3.5", - "wretch": "^2.3.1" - }, - "dependencies": { - "remark-hint": "^1.0.10", - "remark-html": "^15.0.1" - } -} diff --git a/web/postcss.config.cjs b/web/postcss.config.cjs deleted file mode 100644 index afd9a03..0000000 --- a/web/postcss.config.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: [ - require('tailwindcss/nesting'), - require('tailwindcss') - ], -} diff --git a/web/public/admin/config.yml b/web/public/admin/config.yml deleted file mode 100644 index 1df8a1a..0000000 --- a/web/public/admin/config.yml +++ /dev/null @@ -1,27 +0,0 @@ -backend: - name: git-gateway - branch: main - commit_messages: - create: 'Create {{collection}} “{{slug}}”' - update: 'Update {{collection}} “{{slug}}”' - delete: 'Delete {{collection}} “{{slug}}”' - uploadMedia: '[skip ci] Upload “{{path}}”' - deleteMedia: '[skip ci] Delete “{{path}}”' - -media_folder: 'public/images/uploads' # Folder where user uploaded files should go -public_folder: '/images/uploads' - -collections: # A list of collections the CMS should be able to edit - - name: 'post' # Used in routes, ie.: /admin/collections/:slug/edit - label: 'Post' # Used in the UI, ie.: "New Post" - folder: 'src/pages/posts' # The path to the folder where the documents are stored - create: true # Allow users to create new documents in this collection - fields: # The fields each document in this collection have - - {label: "Layout", name: "layout", widget: "hidden", default: "$/layouts/post.astro"} - - { label: 'Title', name: 'title', widget: 'string' } - - { label: 'Description', name: 'description', widget: 'text' } - - { label: 'Body', name: 'body', widget: 'markdown' } - - { label: 'Tags', name: 'tags', widget: 'list' } - - { label: 'Author', name: 'author', widget: 'string' } - - { label: 'Author Twitter Handle', name: 'authorTwitter', widget: 'string' } - - { label: 'Publish Date', name: 'date', widget: 'datetime' } diff --git a/web/public/admin/index.html b/web/public/admin/index.html deleted file mode 100644 index 444918c..0000000 --- a/web/public/admin/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - Astro Ink - Content Manager - - - - diff --git a/web/public/android-chrome-192x192.png b/web/public/android-chrome-192x192.png deleted file mode 100644 index acb42aa..0000000 Binary files a/web/public/android-chrome-192x192.png and /dev/null differ diff --git a/web/public/android-chrome-512x512.png b/web/public/android-chrome-512x512.png deleted file mode 100644 index c94145a..0000000 Binary files a/web/public/android-chrome-512x512.png and /dev/null differ diff --git a/web/public/apple-touch-icon.png b/web/public/apple-touch-icon.png deleted file mode 100644 index f03c543..0000000 Binary files a/web/public/apple-touch-icon.png and /dev/null differ diff --git a/web/public/assets/logo.svg b/web/public/assets/logo.svg deleted file mode 100644 index d751556..0000000 --- a/web/public/assets/logo.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/web/public/assets/yay.svg b/web/public/assets/yay.svg deleted file mode 100644 index c12651b..0000000 --- a/web/public/assets/yay.svg +++ /dev/null @@ -1,925 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/web/public/astro-banner.png b/web/public/astro-banner.png deleted file mode 100644 index 8e08957..0000000 Binary files a/web/public/astro-banner.png and /dev/null differ diff --git a/web/public/astro-ink-logo.png b/web/public/astro-ink-logo.png deleted file mode 100644 index 6938dc4..0000000 Binary files a/web/public/astro-ink-logo.png and /dev/null differ diff --git a/web/public/browserconfig.xml b/web/public/browserconfig.xml deleted file mode 100644 index b3930d0..0000000 --- a/web/public/browserconfig.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - #da532c - - - diff --git a/web/public/favicon-16x16.png b/web/public/favicon-16x16.png deleted file mode 100644 index da1c432..0000000 Binary files a/web/public/favicon-16x16.png and /dev/null differ diff --git a/web/public/favicon-32x32.png b/web/public/favicon-32x32.png deleted file mode 100644 index 6a0e166..0000000 Binary files a/web/public/favicon-32x32.png and /dev/null differ diff --git a/web/public/favicon.ico b/web/public/favicon.ico deleted file mode 100644 index 4b2637d..0000000 Binary files a/web/public/favicon.ico and /dev/null differ diff --git a/web/public/favicon.svg b/web/public/favicon.svg deleted file mode 100644 index 542f90a..0000000 --- a/web/public/favicon.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/web/public/lib/localforage.min.js b/web/public/lib/localforage.min.js deleted file mode 100644 index 7403f8f..0000000 --- a/web/public/lib/localforage.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - localForage -- Offline Storage, Improved - Version 1.10.0 - https://localforage.github.io/localForage - (c) 2013-2017 Mozilla, Apache License 2.0 -*/ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.localforage=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g=43)}}).catch(function(){return!1})}function n(a){return"boolean"==typeof xa?va.resolve(xa):m(a).then(function(a){return xa=a})}function o(a){var b=ya[a.name],c={};c.promise=new va(function(a,b){c.resolve=a,c.reject=b}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function p(a){var b=ya[a.name],c=b.deferredOperations.pop();if(c)return c.resolve(),c.promise}function q(a,b){var c=ya[a.name],d=c.deferredOperations.pop();if(d)return d.reject(b),d.promise}function r(a,b){return new va(function(c,d){if(ya[a.name]=ya[a.name]||B(),a.db){if(!b)return c(a.db);o(a),a.db.close()}var e=[a.name];b&&e.push(a.version);var f=ua.open.apply(ua,e);b&&(f.onupgradeneeded=function(b){var c=f.result;try{c.createObjectStore(a.storeName),b.oldVersion<=1&&c.createObjectStore(wa)}catch(c){if("ConstraintError"!==c.name)throw c;console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.')}}),f.onerror=function(a){a.preventDefault(),d(f.error)},f.onsuccess=function(){var b=f.result;b.onversionchange=function(a){a.target.close()},c(b),p(a)}})}function s(a){return r(a,!1)}function t(a){return r(a,!0)}function u(a,b){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),d=a.versiona.db.version;if(d&&(a.version!==b&&console.warn('The database "'+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),e||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function v(a){return new va(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function w(a){return g([l(atob(a.data))],{type:a.type})}function x(a){return a&&a.__local_forage_encoded_blob}function y(a){var b=this,c=b._initReady().then(function(){var a=ya[b._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return i(c,a,a),c}function z(a){o(a);for(var b=ya[a.name],c=b.forages,d=0;d0&&(!a.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return va.resolve().then(function(){if(!a.db||"NotFoundError"===e.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),t(a)}).then(function(){return z(a).then(function(){A(a,b,c,d-1)})}).catch(c);c(e)}}function B(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function C(a){function b(){return va.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];var f=ya[d.name];f||(f=B(),ya[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=y);for(var g=[],h=0;h>4,k[i++]=(15&d)<<4|e>>2,k[i++]=(3&e)<<6|63&f;return j}function O(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+=Da[(3&c[b])<<4|c[b+1]>>4],d+=Da[(15&c[b+1])<<2|c[b+2]>>6],d+=Da[63&c[b+2]];return c.length%3==2?d=d.substring(0,d.length-1)+"=":c.length%3==1&&(d=d.substring(0,d.length-2)+"=="),d}function P(a,b){var c="";if(a&&(c=Ua.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===Ua.call(a.buffer))){var d,e=Ga;a instanceof ArrayBuffer?(d=a,e+=Ia):(d=a.buffer,"[object Int8Array]"===c?e+=Ka:"[object Uint8Array]"===c?e+=La:"[object Uint8ClampedArray]"===c?e+=Ma:"[object Int16Array]"===c?e+=Na:"[object Uint16Array]"===c?e+=Pa:"[object Int32Array]"===c?e+=Oa:"[object Uint32Array]"===c?e+=Qa:"[object Float32Array]"===c?e+=Ra:"[object Float64Array]"===c?e+=Sa:b(new Error("Failed to get type for BinaryArray"))),b(e+O(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c=Ea+a.type+"~"+O(this.result);b(Ga+Ja+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}}function Q(a){if(a.substring(0,Ha)!==Ga)return JSON.parse(a);var b,c=a.substring(Ta),d=a.substring(Ha,Ta);if(d===Ja&&Fa.test(c)){var e=c.match(Fa);b=e[1],c=c.substring(e[0].length)}var f=N(c);switch(d){case Ia:return f;case Ja:return g([f],{type:b});case Ka:return new Int8Array(f);case La:return new Uint8Array(f);case Ma:return new Uint8ClampedArray(f);case Na:return new Int16Array(f);case Pa:return new Uint16Array(f);case Oa:return new Int32Array(f);case Qa:return new Uint32Array(f);case Ra:return new Float32Array(f);case Sa:return new Float64Array(f);default:throw new Error("Unkown type: "+d)}}function R(a,b,c,d){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,d)}function S(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];var e=new va(function(a,d){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(a){return d(a)}c.db.transaction(function(e){R(e,c,function(){b._dbInfo=c,a()},function(a,b){d(b)})},d)});return c.serializer=Va,e}function T(a,b,c,d,e,f){a.executeSql(c,d,e,function(a,g){g.code===g.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,h){h.rows.length?f(a,g):R(a,b,function(){a.executeSql(c,d,e,f)},f)},f):f(a,g)},f)}function U(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function V(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;h0)return void f(W.apply(e,[a,h,c,d-1]));g(b)}})})}).catch(g)});return h(f,c),f}function X(a,b,c){return W.apply(this,[a,b,c,1])}function Y(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function Z(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function $(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function _(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function aa(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e '__WebKitDatabaseInfoTable__'",[],function(c,d){for(var e=[],f=0;f0}function ha(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=ea(a,b._defaultConfig),ga()?(b._dbInfo=c,c.serializer=Va,va.resolve()):va.reject()}function ia(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=localStorage.length-1;c>=0;c--){var d=localStorage.key(c);0===d.indexOf(a)&&localStorage.removeItem(d)}});return h(c,a),c}function ja(a,b){var c=this;a=j(a);var d=c.ready().then(function(){var b=c._dbInfo,d=localStorage.getItem(b.keyPrefix+a);return d&&(d=b.serializer.deserialize(d)),d});return h(d,b),d}function ka(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=localStorage.length,g=1,h=0;h=0;b--){var c=localStorage.key(b);0===c.indexOf(a)&&localStorage.removeItem(c)}}):va.reject("Invalid arguments"),h(d,b),d}function ra(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function sa(){for(var a=1;a { - let interval, timeout; - - // auto-unlock after a certain amount of time - timeout = setTimeout(async () => { - clearInterval(interval); - await autoUnlockCallback(); - this.unlock(); - resolve("autounlock"); - }, this.autoUnlockAfterMilliseconds); - - // Check every 10ms if the lock is still locked - interval = setInterval(() => { - if (!this.isLocked) { - clearTimeout(timeout); - clearInterval(interval); - resolve("unlock"); - } - }, 10); - }); - } - - unlock() { - this.isLocked = false; - } - - async waitForUnlock() { - if (!this.isLocked) { - return; - } - - await this.lockedPromise; - } -} diff --git a/web/public/lib/message.js b/web/public/lib/message.js deleted file mode 100644 index c776988..0000000 --- a/web/public/lib/message.js +++ /dev/null @@ -1,34 +0,0 @@ - -/// Use this function to send a message to a controlled page. -/// The message will request that the page send the value of the access token to the service worker. -/// If the page has a valid access token, it will be returned through another message. -const requestFromPage = async () => { - // use any controlled page as the client - const allClients = await self.clients.matchAll(); - const client = allClients.filter(client => client.type === "window")[0]; - - // We can't send a message to a client that doesn't exist, so return null - if (client == null) { - return null; - } - - // We're going to use a MessageChannel to communicate - const channel = MessageChannel(); - - console.debug("requesting token from page"); - client.postMessage({ - type: "request-token", - }, [channel.port1]); - - // wrap the onmessage handler in a promise - return new Promise((resolve, reject) => { - channel.port2.onmessage = (event) => { - if (event.data.error) { - console.error("error requesting token from page", event.error); - reject(event.data.error); - } - - resolve(event.data.token); - }; - }); -}; diff --git a/web/public/lib/worker-init.js b/web/public/lib/worker-init.js deleted file mode 100644 index 3c2304d..0000000 --- a/web/public/lib/worker-init.js +++ /dev/null @@ -1,15 +0,0 @@ -// These listeners will install the service worker and activate it immediately. -// Import them in your service worker file to use them. - -self.addEventListener("install", (event) => { - // go directly from "installed" to "activated" even if there are precious instances of the service worker - console.debug("Service worker installed"); - event.waitUntil(self.skipWaiting()); -}); - -self.addEventListener("activate", (event) => { - // Claim all clients immediately - // This ensures that page is controlled without waiting for a reload - console.debug("Service worker activated"); - event.waitUntil(self.clients.claim()); -}); diff --git a/web/public/lib/worker.js b/web/public/lib/worker.js deleted file mode 100644 index 30dcf7f..0000000 --- a/web/public/lib/worker.js +++ /dev/null @@ -1,47 +0,0 @@ -/// serviceworker fetch handler that logs the request url -function logFetch(event) { - const url = new URL(event.request.url); - console.log("fetch", url); - - return fetch(event.request); -} - -/// Appends the authorization header to the request with the access token -function addAuthHeader(request, accessToken) { - console.log("adding auth header", accessToken); - const modifiedHeaders = new Headers(request.headers); - modifiedHeaders.append("Authorization", `Bearer ${accessToken}`); - - const modifiedRequestInit = { headers: modifiedHeaders, mode: "same-origin" }; - - return new Request(request, modifiedRequestInit); -} - -function matchUrls(url, urls = [], containsUrls = []) { - const matchUrls = urls.find((element) => { - if (url.pathname.includes(element)) { - return true; - } - }); - - const matchContainsUrls = containsUrls.find((element) => { - if (url.pathname.includes(element)) { - return true; - } - }); - - return matchUrls || matchContainsUrls; -} - -function getTimestampSeconds() { - return Math.floor(Date.now() / 1000); -} - -function isLoginCallback(url) { - const urls = [ - "/login-callback", - ]; - console.log("checking if login callback", url); - - return matchUrls(url, urls); -} diff --git a/web/public/mstile-150x150.png b/web/public/mstile-150x150.png deleted file mode 100644 index 13604e9..0000000 Binary files a/web/public/mstile-150x150.png and /dev/null differ diff --git a/web/public/robots.txt b/web/public/robots.txt deleted file mode 100644 index 1f53798..0000000 --- a/web/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / diff --git a/web/public/safari-pinned-tab.svg b/web/public/safari-pinned-tab.svg deleted file mode 100644 index 8c6ad0d..0000000 --- a/web/public/safari-pinned-tab.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - - -Created by potrace 1.14, written by Peter Selinger 2001-2017 - - - - - - diff --git a/web/public/serviceWorker.js b/web/public/serviceWorker.js deleted file mode 100644 index e58ea24..0000000 --- a/web/public/serviceWorker.js +++ /dev/null @@ -1,136 +0,0 @@ -importScripts("/lib/localforage.min.js"); -importScripts("/lib/locks.js"); -importScripts("/lib/worker.js"); -importScripts("/lib/worker-init.js"); -importScripts("/lib/message.js"); - -const ACCESS_TOKEN = "application-access-token"; -const ACCESS_TOKEN_CONFIRMED_UNAUTHORIZED = "unauthorized"; - -let refreshTokensLock = new ExecutionLock(); - -// self.addEventListener("fetch", (event) => event.respondWith(logFetch(event))); -self.addEventListener("fetch", async (event) => { - event.respondWith(processFetch(event)); - // event.respondWith(logFetch(event)); -}); - -self.addEventListener("message", async (event) => { - console.debug("sw: message", event); - if (event.data.type === "login-callback") { - const token = event.data.token; - console.info("sw: received token from callback page", token); - - // Store the token in for later use - await localforage.setItem(ACCESS_TOKEN, token); - - // Redirect the page to the home page (removes the token from the url) - const redirectTo = event.data.redirectTo; - const client = event.source; - // TODO: Should we check to see if the client is a window? - client.navigate(redirectTo); - } else if (event.data.type === "logout") { - // Remove the token from localForage - await localforage.removeItem(ACCESS_TOKEN); - - const client = event.source; - const redirectTo = event.data.redirectTo; - client.navigate(redirectTo); - } -}); - -function processFetch(event) { - const url_string = event.request.url; - const url = new URL(url_string); - console.debug("sw: checking", url); - if (url.pathname.includes("api")) { - console.log("has api"); - } - - // If the request is navigating to a new page, or is an API request, then we want to allow it through unmodified - const urlIsThisHost = url.hostname === self.location.hostname; - const isApiRequest = event.request.mode === "navigate" || url.pathname.startsWith("/api/"); - if (urlIsThisHost && isApiRequest) { - // This is a reuqest to the API, so we need to ensure there is a token available - return processTokenFetch(event); - } - - console.debug("sw: skipping", url); - return fetch(event.request); -} - -async function processTokenFetch(event) { - const url = new URL(event.request.url); - console.log("sw: processing", url); - - /* - * Goal: Attach an access token to requests that match the following criteria: - * - The request is to the same host as the service worker - * - The request is not a navigation request - * - The request is going to the API (route starts with /api/) - */ - - /* - * Retrieving a token: - * - Ideally, we want to use the token that is stored in localForage - * - If there is no token in localForage, then we want to request the token from the page - * - Finally, if there is no token in localForage and the page doesn't have a token, then we want to request a new token from the server - * - If we don't have a token at this point, then we are unauthorized and should let the request through without a token - */ - - await refreshTokensLock.waitForUnlock(); - - let accessToken = await localforage.getItem(ACCESS_TOKEN); - - if (accessToken == null) { - // If there isn't a token, try to refresh - accessToken = await refreshToken(event); - - // If we can't refresh (token is null), then we are unauthorized - if (accessToken == null) { - accessToken = ACCESS_TOKEN_CONFIRMED_UNAUTHORIZED; - await localforage.setItem(ACCESS_TOKEN, accessToken); - } - } - - // finally, if we have a token, then we can add it to the request - // Check if the token is not expired - if ( - typeof accessToken === "string" && - accessToken !== ACCESS_TOKEN_CONFIRMED_UNAUTHORIZED - ) { - let expiration = await (async () => { - let decodedBody = JSON.parse(atob(accessToken.split(".")[1])); - return decodedBody.exp; - })(); - - // If the token is expired, then refresh it - if (expiration < getTimestampSeconds()) { - accessToken = await refreshToken(event); - } - - // If the token is a string and not "unauthorized", then we are authorized - if ( - typeof accessToken === "string" && - accessToken !== ACCESS_TOKEN_CONFIRMED_UNAUTHORIZED - ) { - const modifiedRequest = addAuthHeader( - event.request, - accessToken - ); - - return fetch(modifiedRequest); - } - } - - // if we get here, we should return unmodified. Ideally we should redirect to the login page - return fetch(event.request); -} - -/* Attempt to refresh the token -* - if the request is successful, the access token is stored in localForage -*/ -async function refreshToken(event) { - // TODO: We don't support refreshing tokens yet - return null; -} diff --git a/web/public/site.webmanifest b/web/public/site.webmanifest deleted file mode 100644 index 5f6389c..0000000 --- a/web/public/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "Astro Ink", - "short_name": "Astro Ink", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/web/src/components/BaseHead.astro b/web/src/components/BaseHead.astro deleted file mode 100644 index fd4a6ee..0000000 --- a/web/src/components/BaseHead.astro +++ /dev/null @@ -1,37 +0,0 @@ ---- - import '@fontsource/fira-sans' - import { SITE } from '$/config' - import '../styles/global.css' - - export type Props = { - title: string - description: string - permalink: string - image: string - } - - const { title = SITE.title , description, permalink, image } = Astro.props as Props ---- - - - - - - {title} - - {description && - - } - - - - - - - - - - - diff --git a/web/src/components/BaseLayout.astro b/web/src/components/BaseLayout.astro deleted file mode 100644 index 0016c70..0000000 --- a/web/src/components/BaseLayout.astro +++ /dev/null @@ -1,7 +0,0 @@ - -
-
- -
-
- diff --git a/web/src/components/Footer.astro b/web/src/components/Footer.astro deleted file mode 100644 index 03b5e06..0000000 --- a/web/src/components/Footer.astro +++ /dev/null @@ -1,21 +0,0 @@ ---- - import { SITE } from '$/config' - import ModeLabel from './ModeLabel.svelte' ---- -
- -
- - diff --git a/web/src/components/Header.astro b/web/src/components/Header.astro deleted file mode 100644 index d1e9fdd..0000000 --- a/web/src/components/Header.astro +++ /dev/null @@ -1,60 +0,0 @@ ---- - import { SITE } from '$/config' - import SvgIcon from './SvgIcon.astro' - import ModeSwitcherBtn from './ModeSwitcherBtn.svelte' - ---- - -
-
-

- { SITE.name } -

-
-

- { SITE.description } -

- -
-
-
- - diff --git a/web/src/components/Intro.astro b/web/src/components/Intro.astro deleted file mode 100644 index 5fd42f1..0000000 --- a/web/src/components/Intro.astro +++ /dev/null @@ -1,10 +0,0 @@ -Yay! - - diff --git a/web/src/components/MainLayout.astro b/web/src/components/MainLayout.astro deleted file mode 100644 index 425b5b1..0000000 --- a/web/src/components/MainLayout.astro +++ /dev/null @@ -1,24 +0,0 @@ ---- -import BaseLayout from './BaseLayout.astro'; -import Header from './Header.astro'; -import Footer from './Footer.astro'; -import Nav from './Nav.astro'; -import Portal from './Portal.astro'; - ---- - -
-
-