Skip to content

Commit

Permalink
chore: @nsnanocat/util
Browse files Browse the repository at this point in the history
  • Loading branch information
VirgilClyne committed Oct 25, 2024
1 parent 4e7a62d commit f2308f6
Show file tree
Hide file tree
Showing 53 changed files with 350 additions and 3,017 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
cache: 'npm'
- name: Install dependencies
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Update local package.json version from release tag
if: github.ref_type == 'tag'
uses: BellCubeDev/update-package-version-by-release-tag@v2
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- dev

permissions:
actions: read
contents: read

jobs:
dev:
uses: ./.github/workflows/dev.yml
secrets: inherit
deploy:
needs: dev
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@master
with:
name: artifact
- name: Deploy Composite.Subtitles.response
uses: exuanbo/actions-deploy-gist@main
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 92cd6fbcde657fb43c67ed7f2430a994
gist_description: "🍿️ DualSubs: 🎦 Universal β"
file_path: dist/Composite.Subtitles.response.bundle.js
- name: Deploy External.Lyrics.response
uses: exuanbo/actions-deploy-gist@main
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 92cd6fbcde657fb43c67ed7f2430a994
gist_description: "🍿️ DualSubs: 🎦 Universal β"
file_path: dist/External.Lyrics.response.bundle.js
- name: Deploy Manifest.response
uses: exuanbo/actions-deploy-gist@main
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 92cd6fbcde657fb43c67ed7f2430a994
gist_description: "🍿️ DualSubs: 🎦 Universal β"
file_path: dist/Manifest.response.bundle.js
- name: Deploy Translate.response
uses: exuanbo/actions-deploy-gist@main
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 92cd6fbcde657fb43c67ed7f2430a994
gist_description: "🍿️ DualSubs: 🎦 Universal β"
file_path: dist/Translate.response.bundle.js
38 changes: 38 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Dev
on:
workflow_call:
workflow_dispatch:

permissions:
actions: read
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_TOKEN }}
ref: dev
- name: Set up Node.js
uses: actions/setup-node@main
with:
node-version: 'latest'
cache: 'npm'
- name: Install dependencies
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Build
run: npm run build:dev
- name: Upload artifact
uses: actions/upload-artifact@master
with:
name: artifact
path: |
CHANGELOG.md
rulesets
dist
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@
[submodule "src/LRC"]
path = src/LRC
url = https://github.com/DualSubs/LRC.git
[submodule "src/utils"]
path = src/utils
url = https://github.com/NanoCat-Me/utils.git
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@nsnanocat:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
### 🛠️ Bug Fixes
* 修复 `Disney+` 中的 `Hulu Hub` 支持
* 修复 `$argument``$persistentStore` 载入顺序颠倒的问题
* 正确顺序为先读取 `$argument` 再读取 `$persistentStore (BoxJs)`
* 即,有相同键名时,`$persistentStore (BoxJs)` 的值会覆盖 `$argument` 的值

### 🔄 Other Changes
* util 由 `submodule` 更改为 `package`
10 changes: 8 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"indentStyle": "tab",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 240
"lineWidth": 320
},
"javascript": {
"formatter": {
Expand Down Expand Up @@ -40,7 +40,11 @@
"correctness": {
"noInnerDeclarations": "info",
"noSelfAssign": "off",
"noSwitchDeclarations": "info"
"noSwitchDeclarations": "info",
"noUnsafeOptionalChaining": "info"
},
"performance": {
"noDelete": "info"
},
"recommended": true,
"style": {
Expand All @@ -56,7 +60,9 @@
},
"suspicious": {
"noAssignInExpressions": "info",
"noDoubleEquals": "info",
"noFallthroughSwitchClause": "info",
"noGlobalIsNan": "off",
"useDefaultSwitchClauseLast": "off"
}
}
Expand Down
1 change: 0 additions & 1 deletion js/Composite.Subtitles.response.js

This file was deleted.

1 change: 0 additions & 1 deletion js/External.Lyrics.response.js

This file was deleted.

1 change: 0 additions & 1 deletion js/Manifest.response.js

This file was deleted.

1 change: 0 additions & 1 deletion js/Translate.response.js

This file was deleted.

175 changes: 0 additions & 175 deletions modules/DualSubs.Universal.beta.sgmodule

This file was deleted.

48 changes: 33 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dualsubs/universal",
"version": "1.5.4",
"version": "1.5.6",
"organizationName": "🍿️ DualSubs",
"displayName": "🍿️ DualSubs: 🔣 Universal",
"description": "流媒体平台字幕增强及双语模块\n如需恢复TV完整支持\n请配合“ iRingo: 📺 TV”使用",
Expand Down Expand Up @@ -39,6 +39,7 @@
],
"devDependencies": {
"@iringo/arguments-builder": "^1.7.8",
"@nsnanocat/util": "^1.3.2",
"@protobuf-ts/plugin": "^2.9.4",
"@protobuf-ts/runtime": "^2.9.4",
"@rspack/cli": "^1.0.11",
Expand Down
9 changes: 6 additions & 3 deletions src/Composite.Subtitles.response.dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { $platform, URL, _, Storage, fetch, notification, log, logError, wait, done, getScript, runScript } from "./utils/utils.mjs";
import { $platform, URL, Lodash as _, Storage, fetch, notification, log, logError, wait, done, getScript, runScript } from "@nsnanocat/util";
import XML from "./XML/XML.mjs";
import VTT from "./WebVTT/WebVTT.mjs";
import database from "./database/index.mjs";
Expand All @@ -13,7 +13,10 @@ import Composite from "./class/Composite.mjs";
const url = new URL($request.url);
log(`⚠ url: ${url.toJSON()}`, "");
// 获取连接参数
const METHOD = $request.method, HOST = url.hostname, PATH = url.pathname, PATHs = url.pathname.split("/").filter(Boolean);
const METHOD = $request.method,
HOST = url.hostname,
PATH = url.pathname,
PATHs = url.pathname.split("/").filter(Boolean);
log(`⚠ METHOD: ${METHOD}, HOST: ${HOST}, PATH: ${PATH}`, "");
// 解析格式
let FORMAT = ($response.headers?.["Content-Type"] ?? $response.headers?.["content-type"])?.split(";")?.[0];
Expand Down Expand Up @@ -265,7 +268,7 @@ function getSubtitlesCache(url, cache, languages) {
const array = Value;
if (
array?.some((string, index) => {
if (url.includes(String || null)) {
if (url.includes(string || null)) {
subtitlesIndex = index;
log("🚧 getSubtitlesCache", `subtitlesIndex: ${subtitlesIndex}`, "");
return true;
Expand Down
Loading

0 comments on commit f2308f6

Please sign in to comment.