diff --git a/.github/actions/yarn-nm-install/action.yml b/.github/actions/yarn-nm-install/action.yml deleted file mode 100644 index 2ec604d..0000000 --- a/.github/actions/yarn-nm-install/action.yml +++ /dev/null @@ -1,123 +0,0 @@ -######################################################################################## -# "yarn install" composite action for yarn 3/4+ and "nodeLinker: node-modules" # -#--------------------------------------------------------------------------------------# -# Requirement: @setup/node should be run before # -# # -# Usage in workflows steps: # -# # -# - name: 📥 Monorepo install # -# uses: ./.github/actions/yarn-nm-install # -# with: # -# enable-corepack: false # (default = 'false') # -# cwd: ${{ github.workspace }}/apps/my-app # (default = '.') # -# cache-prefix: add cache key prefix # (default = 'default') # -# cache-node-modules: false # (default = 'false') # -# cache-install-state: false # (default = 'false') # -# # -# Reference: # -# - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a # -# # -# Versions: # -# - 1.1.0 - 22-07-2023 - Option to enable npm global cache folder. # -# - 1.0.4 - 15-07-2023 - Fix corepack was always enabled. # -# - 1.0.3 - 05-07-2023 - YARN_ENABLE_MIRROR to false (speed up cold start) # -# - 1.0.2 - 02-06-2023 - install-state default to false # -# - 1.0.1 - 29-05-2023 - cache-prefix doc # -# - 1.0.0 - 27-05-2023 - new input: cache-prefix # -######################################################################################## - -name: 'Monorepo install (yarn)' -description: 'Run yarn install with node_modules linker and cache enabled' -inputs: - cwd: - description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()" - required: false - default: '.' - cache-prefix: - description: 'Add a specific cache-prefix' - required: false - default: 'default' - cache-npm-cache: - description: 'Cache npm global cache folder often used by node-gyp, prebuild binaries (invalidated on lock/os/node-version)' - required: false - default: 'true' - cache-node-modules: - description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)' - required: false - default: 'false' - cache-install-state: - description: 'Cache yarn install state, might speed up resolution step when node-modules cache is activated (invalidated lock/os/node-version/branch)' - required: false - default: 'false' - enable-corepack: - description: 'Enable corepack' - required: false - default: 'true' - -runs: - using: 'composite' - - steps: - - name: ⚙️ Enable Corepack - if: inputs.enable-corepack == 'true' - shell: bash - working-directory: ${{ inputs.cwd }} - run: corepack enable - - - name: ⚙️ Expose yarn config as "$GITHUB_OUTPUT" - id: yarn-config - shell: bash - working-directory: ${{ inputs.cwd }} - env: - YARN_ENABLE_GLOBAL_CACHE: 'false' - run: | - echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - echo "CURRENT_NODE_VERSION="node-$(node --version)"" >> $GITHUB_OUTPUT - echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT - echo "NPM_GLOBAL_CACHE_FOLDER=$(npm config get cache)" >> $GITHUB_OUTPUT - - - name: ♻️ Restore yarn cache - uses: actions/cache@v3 - id: yarn-download-cache - with: - path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} - key: yarn-download-cache-${{ inputs.cache-prefix }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }} - restore-keys: | - yarn-download-cache-${{ inputs.cache-prefix }}- - - - name: ♻️ Restore node_modules - if: inputs.cache-node-modules == 'true' - id: yarn-nm-cache - uses: actions/cache@v3 - with: - path: ${{ inputs.cwd }}/**/node_modules - key: yarn-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }} - - - name: ♻️ Restore global npm cache folder - if: inputs.cache-npm-cache == 'true' - id: npm-global-cache - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-config.outputs.NPM_GLOBAL_CACHE_FOLDER }} - key: npm-global-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }} - - - name: ♻️ Restore yarn install state - if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true' - id: yarn-install-state-cache - uses: actions/cache@v3 - with: - path: ${{ inputs.cwd }}/.yarn/ci-cache - key: yarn-install-state-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }} - - - name: 📥 Install dependencies - shell: bash - working-directory: ${{ inputs.cwd }} - run: yarn install --immutable --inline-builds - env: - # Overrides/align yarnrc.yml options (v3, v4) for a CI context - YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives - YARN_ENABLE_MIRROR: 'false' # Prevent populating global cache for caches misses (local cache only) - YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size - YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz' # Might speed up resolution step when node_modules present - # Other environment variables - HUSKY: '0' # By default do not run HUSKY install \ No newline at end of file diff --git a/.github/workflows/bun.yml b/.github/workflows/bun.yml new file mode 100644 index 0000000..8ee8a91 --- /dev/null +++ b/.github/workflows/bun.yml @@ -0,0 +1,26 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use bun + uses: oven-sh/setup-bun@v2 + + - name: 📥 Install dependencies + run: bun install + - name: 📦 Build + run: bun run build diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 61884fb..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [21.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: 📥 Monorepo install - uses: ./.github/actions/yarn-nm-install - - - name: Check Yarn Version - run: yarn --version - - - name: Build the project - run: yarn build diff --git a/.yarnrc.yml b/.yarnrc.yml deleted file mode 100644 index 3186f3f..0000000 --- a/.yarnrc.yml +++ /dev/null @@ -1 +0,0 @@ -nodeLinker: node-modules diff --git a/bun.lockb b/bun.lockb new file mode 100644 index 0000000..d968990 Binary files /dev/null and b/bun.lockb differ diff --git a/default.d.ts b/default.d.ts index c2cd464..6b281da 100644 --- a/default.d.ts +++ b/default.d.ts @@ -1,3 +1,5 @@ +import { LoadingBarProviderInst, MessageProviderInst } from "naive-ui" + declare module 'vue3-aplayer' { const content: any export = content @@ -9,4 +11,11 @@ declare module 'file-saver' { declare module '*.js' { const content: any export = content +} + +declare global { + interface Window { + $message: MessageProviderInst, + $loadingBar: LoadingBarProviderInst + } } \ No newline at end of file diff --git a/gen-version.js b/gen-version.js deleted file mode 100644 index 9a35a98..0000000 --- a/gen-version.js +++ /dev/null @@ -1,6 +0,0 @@ -const fs = require('fs') -const path = require('path') - -const version = Date.now() -const versionModule = `export const version = "${version}"` -fs.writeFileSync(path.resolve(__dirname, 'src/version.js'), versionModule) diff --git a/index.html b/index.html index 7248f94..e9d98f3 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,9 @@ src="https://umami.vtsuru.live/script.js" data-website-id="05567214-d234-4076-9228-e4d69e3d202f" > + + + diff --git a/package.json b/package.json index 2e40d78..9f91083 100644 --- a/package.json +++ b/package.json @@ -4,68 +4,69 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", + "dev": "bunx --bun vite", "build": "vite build", "lint": "vite lint" }, "dependencies": { - "@microsoft/signalr": "^8.0.0", - "@microsoft/signalr-protocol-msgpack": "^8.0.0", - "@types/node": "^20.12.7", - "@typescript-eslint/eslint-plugin": "^7.7.0", + "@microsoft/signalr": "^8.0.7", + "@microsoft/signalr-protocol-msgpack": "^8.0.7", + "@types/node": "^22.8.2", + "@typescript-eslint/eslint-plugin": "^8.12.1", "@vicons/fluent": "^0.12.0", - "@vitejs/plugin-vue": "^5.0.4", - "@vueuse/core": "^10.9.0", - "@vueuse/router": "^10.9.0", + "@vitejs/plugin-vue": "^5.1.4", + "@vue/cli": "^5.0.8", + "@vueuse/core": "^11.1.0", + "@vueuse/router": "^11.1.0", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.12", - "date-fns": "^3.6.0", - "easy-speech": "^2.3.1", - "echarts": "^5.5.0", - "eslint": "^9.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-oxlint": "^0.2.9", - "eslint-plugin-prettier": "^5.1.3", - "fast-xml-parser": "^4.3.6", + "date-fns": "^4.1.0", + "easy-speech": "^2.4.0", + "echarts": "^5.5.1", + "eslint": "^9.13.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-oxlint": "^0.10.1", + "eslint-plugin-prettier": "^5.2.1", + "fast-xml-parser": "^4.5.0", "file-saver": "^2.0.5", "grapheme-splitter": "^1.0.4", "html2canvas": "^1.4.1", - "linqts": "^1.15.0", + "linqts": "^2.0.0", "mitt": "^3.0.1", - "music-metadata-browser": "^2.5.10", - "pinia": "^2.1.7", - "prettier": "^3.2.5", - "qrcode.vue": "^3.4.1", + "music-metadata-browser": "^2.5.11", + "pinia": "^2.2.4", + "prettier": "^3.3.3", + "qrcode.vue": "^3.5.1", "queue-typescript": "^1.0.1", "unplugin-vue-markdown": "^0.26.2", - "uuid": "^9.0.1", - "vite": "^5.2.10", + "uuid": "^11.0.2", + "vite": "^5.4.10", "vite-svg-loader": "^5.1.0", - "vue": "3.4.21", - "vue-echarts": "^6.6.10", + "vue": "3.5.12", + "vue-echarts": "^7.0.3", "vue-request": "^2.0.4", - "vue-router": "^4.3.2", - "vue-turnstile": "^1.0.8", + "vue-router": "^4.4.5", + "vue-turnstile": "^1.0.11", "vue3-aplayer": "^1.7.3", - "vue3-marquee": "^4.2.0", - "vueuc": "^0.4.58", - "worker-timers": "^7.1.7", + "vue3-marquee": "^4.2.2", + "vueuc": "^0.4.64", + "worker-timers": "^8.0.10", "xlsx": "^0.18.5" }, "devDependencies": { - "@eslint/eslintrc": "^3.0.2", - "@types/eslint": "^8.56.10", + "@eslint/eslintrc": "^3.1.0", + "@types/bun": "^1.1.12", + "@types/eslint": "^9.6.1", "@types/obs-studio": "^2.17.2", - "@types/uuid": "^9.0.8", - "@typescript-eslint/parser": "^7.7.0", + "@types/uuid": "^10.0.0", + "@typescript-eslint/parser": "^8.12.1", "@vicons/ionicons5": "^0.12.0", - "@vitejs/plugin-vue-jsx": "^3.1.0", - "@vue/eslint-config-typescript": "^13.0.0", + "@vitejs/plugin-vue-jsx": "^4.0.1", + "@vue/eslint-config-typescript": "^14.1.3", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-vue": "^9.25.0", - "naive-ui": "^2.38.1", - "stylus": "^0.63.0", - "typescript": "^5.4.5" - }, - "packageManager": "yarn@4.0.2" -} + "eslint-plugin-vue": "^9.30.0", + "naive-ui": "^2.40.1", + "stylus": "^0.64.0", + "typescript": "^5.6.3" + } +} \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 529b238..23792cc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,11 +1,6 @@ - diff --git a/src/Utils.ts b/src/Utils.ts index 3f84be6..0657a17 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -1,16 +1,44 @@ import { useStorage } from '@vueuse/core' -import { UploadFileInfo, createDiscreteApi, useOsTheme } from 'naive-ui' +import { + ConfigProviderProps, + UploadFileInfo, + createDiscreteApi, + darkTheme, + dateZhCN, + useOsTheme, + zhCN +} from 'naive-ui' import { ThemeType } from './api/api-models' import { computed } from 'vue' import { VTSURU_API_URL } from './data/constants' +import { DiscreteApiType } from 'naive-ui/es/discrete/src/interface' const { message } = createDiscreteApi(['message']) const osThemeRef = useOsTheme() //获取当前系统主题 +const themeType = useStorage('Settings.Theme', ThemeType.Auto) +export const theme = computed(() => { + if (themeType.value == ThemeType.Auto) { + var osThemeRef = useOsTheme() //获取当前系统主题 + return osThemeRef.value === 'dark' ? darkTheme : null + } else { + return themeType.value == ThemeType.Dark ? darkTheme : null + } +}) +export const configProviderPropsRef = computed(() => ({ + theme: theme.value, + locale: zhCN, + dateLocale: dateZhCN, + +})) +export function createNaiveUIApi(types: DiscreteApiType[]) { + return createDiscreteApi(types, { + configProviderProps: configProviderPropsRef + }) +} export function NavigateToNewTab(url: string) { window.open(url, '_blank') } -const themeType = useStorage('Settings.Theme', ThemeType.Auto) export const isDarkMode = computed(() => { if (themeType.value == ThemeType.Auto) return osThemeRef.value === 'dark' else return themeType.value == ThemeType.Dark @@ -73,22 +101,25 @@ export function downloadImage(imageSrc: string, filename: string) { } image.src = imageSrc } -export function getBase64(file: File | undefined | null): Promise { +export function getBase64( + file: File | undefined | null +): Promise { if (!file) return new Promise((resolve) => resolve(undefined)) return new Promise((resolve, reject) => { const reader = new FileReader() reader.readAsDataURL(file) - reader.onload = () => resolve(reader.result?.toString().split(',')[1] || undefined) + reader.onload = () => + resolve(reader.result?.toString().split(',')[1] || undefined) reader.onerror = (error) => reject(error) }) } export async function getImageUploadModel( files: UploadFileInfo[] | undefined | null, - maxSize: number = 10 * 1024 * 1024, + maxSize: number = 10 * 1024 * 1024 ) { const result = { existImages: [], - newImagesBase64: [], + newImagesBase64: [] } as { existImages: string[]; newImagesBase64: string[] } if (!files) return result for (let i = 0; i < files.length; i++) { @@ -146,7 +177,11 @@ export class GuidUtils { const bytes = new Uint8Array(buffer) const guid = bytes.reduce((str, byte, idx) => { const pair = byte.toString(16).padStart(2, '0') - return str + pair + (idx === 3 || idx === 5 || idx === 7 || idx === 9 ? '-' : '') + return ( + str + + pair + + (idx === 3 || idx === 5 || idx === 7 || idx === 9 ? '-' : '') + ) }, '') return guid } diff --git a/src/components/DanmakuItem.vue b/src/components/DanmakuItem.vue index 2c33aeb..3cc2b21 100644 --- a/src/components/DanmakuItem.vue +++ b/src/components/DanmakuItem.vue @@ -135,7 +135,7 @@ defineEmits<{ - +