diff --git a/.github/workflows/deploy-azure.yml b/.github/workflows/deploy-azure.yml index aabf7dce..873eb11b 100644 --- a/.github/workflows/deploy-azure.yml +++ b/.github/workflows/deploy-azure.yml @@ -24,7 +24,7 @@ jobs: ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "/" # App source code path - app_build_command: "yarn build && sed -i 's/fonts.gstatic.com/fonts.kavin.rocks/g' dist/assets/*.css" + app_build_command: "yarn build && ./localizefonts.sh" api_location: "" # Api source code path - optional output_location: "dist" # Built app content directory - optional ###### End of Repository/Build Configurations ###### diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 473b8ce3..859310ba 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -12,14 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: true - name: Setup Node.js uses: actions/setup-node@v3 with: cache: "yarn" - run: yarn install --prefer-offline - - run: yarn build --out-dir dist-ci && sed -i 's/fonts.gstatic.com/fonts.kavin.rocks/g' dist-ci/assets/*.css + - run: yarn build && ./localizefonts.sh && mv dist/ dist-ci/ - name: Set up QEMU uses: docker/setup-qemu-action@v2 with: diff --git a/.github/workflows/ipfs-build.yml b/.github/workflows/ipfs-build.yml index 99aeb7ba..ccd1d8b3 100644 --- a/.github/workflows/ipfs-build.yml +++ b/.github/workflows/ipfs-build.yml @@ -12,14 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: true - name: Setup Node.js uses: actions/setup-node@v3 with: cache: "yarn" - run: yarn install --prefer-offline - - run: yarn build && sed -i 's/fonts.gstatic.com/fonts.kavin.rocks/g' dist/assets/*.css && cp dist/index.html dist/ipfs-404.html + - run: yarn build && ./localizefonts.sh && cp dist/index.html dist/ipfs-404.html - uses: aquiladev/ipfs-action@v0.3.1-alpha.2 id: ipfs-add with: diff --git a/Dockerfile b/Dockerfile index 68e50f0d..d005c367 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,16 @@ FROM node:lts-alpine AS build WORKDIR /app/ +RUN --mount=type=cache,target=/var/cache/apk \ + apk add --no-cache \ + curl + COPY . . RUN --mount=type=cache,target=/root/.cache/yarn \ --mount=type=cache,target=/app/node_modules \ yarn install --prefer-offline && \ - yarn build && sed -i 's/fonts.gstatic.com/fonts.kavin.rocks/g' dist/assets/*.css + yarn build && ./localizefonts.sh FROM nginx:alpine diff --git a/localizefonts.sh b/localizefonts.sh new file mode 100755 index 00000000..f3d189f1 --- /dev/null +++ b/localizefonts.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +base='https://fonts\.(gstatic\.com|kavin\.rocks)' +fonts=$(cat dist/assets/* | grep -Po "$base[^)]*" | sort | uniq) +for font in $fonts; do + file="dist/fonts$(echo $font | sed -E "s#$base##")" + mkdir -p "$(dirname "$file")" + curl -L "$font" -o "$file" +done +sed -Ei "s#$base#/fonts#g" dist/assets/* diff --git a/package.json b/package.json index f9161981..2b315ae7 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@fortawesome/free-solid-svg-icons": "6.2.1", "@fortawesome/vue-fontawesome": "3.0.2", "buffer": "6.0.3", - "dompurify": "2.4.1", + "dompurify": "2.4.2", "hotkeys-js": "3.10.1", "javascript-time-ago": "2.5.9", "mux.js": "6.2.0", @@ -26,24 +26,24 @@ "xml-js": "1.6.11" }, "devDependencies": { - "@iconify/json": "2.1.153", + "@iconify/json": "2.2.3", "@intlify/vite-plugin-vue-i18n": "6.0.3", - "@unocss/preset-icons": "0.47.6", - "@unocss/preset-web-fonts": "0.47.6", - "@unocss/transformer-directives": "0.47.6", - "@unocss/transformer-variant-group": "0.47.6", + "@unocss/preset-icons": "0.48.2", + "@unocss/preset-web-fonts": "0.48.2", + "@unocss/transformer-directives": "0.48.2", + "@unocss/transformer-variant-group": "0.48.2", "@vitejs/plugin-legacy": "3.0.1", "@vitejs/plugin-vue": "4.0.0", "@vue/compiler-sfc": "3.2.45", - "eslint": "8.29.0", - "eslint-config-prettier": "8.5.0", + "eslint": "8.31.0", + "eslint-config-prettier": "8.6.0", "eslint-plugin-prettier": "4.2.1", "eslint-plugin-vue": "9.8.0", "prettier": "2.8.1", - "unocss": "0.47.6", + "unocss": "0.48.2", "vite": "3.2.5", "vite-plugin-eslint": "1.8.1", - "vite-plugin-pwa": "0.14.0" + "vite-plugin-pwa": "0.14.1" }, "eslintConfig": { "root": true, diff --git a/public/efy b/public/efy index f5fe0a2b..64c903b6 160000 --- a/public/efy +++ b/public/efy @@ -1 +1 @@ -Subproject commit f5fe0a2b2f142e36743eaaf030fabdbd19808386 +Subproject commit 64c903b6bf21ed8c3f6259f7b8e02266968b91db diff --git a/src/components/CommentItem.vue b/src/components/CommentItem.vue index 04cfb473..7dd24a3a 100644 --- a/src/components/CommentItem.vue +++ b/src/components/CommentItem.vue @@ -24,7 +24,7 @@ -
+