Skip to content

Commit 4152f1e

Browse files
authored
Merge pull request #38 from nuthx/dev-2.0.3
Dev 2.0.3
2 parents 2a7a448 + 6c79ca2 commit 4152f1e

File tree

13 files changed

+150
-59
lines changed

13 files changed

+150
-59
lines changed

.github/workflows/build.yml

Lines changed: 59 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,30 @@ on:
88

99
jobs:
1010
build:
11-
permissions:
12-
contents: write
13-
actions: read
14-
1511
strategy:
1612
fail-fast: false
1713
matrix:
1814
include:
19-
- os: macos-latest
15+
- name: macOS (Apple Silicon)
16+
os: macos-latest
2017
target: aarch64-apple-darwin
18+
args: --bundles dmg
19+
artifact: subtitle-renamer_${{ github.ref_name }}_macos_aarch64.dmg
2120

22-
- os: macos-latest
21+
- name: macOS (Intel)
22+
os: macos-latest
2323
target: x86_64-apple-darwin
24+
args: --bundles dmg
25+
artifact: subtitle-renamer_${{ github.ref_name }}_macos_x64.dmg
2426

25-
- os: windows-latest
27+
- name: Windows (x64)
28+
os: windows-latest
2629
target: x86_64-pc-windows-msvc
30+
args: --no-bundle
31+
artifact: subtitle-renamer_${{ github.ref_name }}_windows_x64.zip
32+
exeName: Subtitle Renamer.exe
2733

34+
name: Build (${{ matrix.name }})
2835
runs-on: ${{ matrix.os }}
2936

3037
steps:
@@ -55,44 +62,59 @@ jobs:
5562
- name: Install frontend dependencies
5663
run: pnpm install
5764

58-
- name: Build and release
59-
uses: tauri-apps/tauri-action@v0
65+
- name: Build Tauri app
66+
run: pnpm tauri build --target ${{ matrix.target }} ${{ matrix.args }}
6067
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
with:
63-
tagName: ${{ github.ref_name }}
64-
releaseName: v${{ github.ref_name }}
65-
releaseBody: |
66-
## 新增
67-
- 新增内容
68-
69-
## 优化
70-
- 优化内容
68+
CI: ${{ matrix.os == 'macos-latest' && 'false' || 'true' }}
7169

72-
## 修复
73-
- 修复内容
74-
releaseDraft: true
75-
assetNamePattern: >-
76-
${{ matrix.os == 'macos-latest'
77-
&& 'subtitle-renamer_[version]_macos_[arch][ext]'
78-
|| 'Subtitle Renamer' }}
79-
args: >-
80-
${{ matrix.os == 'macos-latest'
81-
&& format('--target {0} --bundles dmg', matrix.target)
82-
|| format('--target {0} --no-bundle', matrix.target) }}
83-
uploadPlainBinary: ${{ matrix.os == 'windows-latest' }}
84-
85-
- name: Zip Windows exe
70+
- name: Prepare macOS artifact
71+
if: matrix.os == 'macos-latest'
72+
run: |
73+
DMG=$(find src/target/${{ matrix.target }}/release/bundle/dmg -name "*.dmg" | head -1)
74+
cp "$DMG" "${{ matrix.artifact }}"
75+
76+
- name: Prepare Windows artifact
8677
if: matrix.os == 'windows-latest'
8778
shell: powershell
8879
run: |
8980
$exe = Get-ChildItem src\target\${{ matrix.target }}\release\*.exe
90-
Compress-Archive -Path $exe.FullName -DestinationPath subtitle-renamer_${{ github.ref_name }}_windows_x64.zip
81+
Copy-Item $exe.FullName "${{ matrix.exeName }}"
82+
Compress-Archive -Path "${{ matrix.exeName }}" -DestinationPath ${{ matrix.artifact }}
9183
92-
- name: Upload Windows zip
93-
if: matrix.os == 'windows-latest'
84+
- name: Upload artifacts
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: ${{ matrix.target }}
88+
path: ${{ matrix.artifact }}
89+
90+
release:
91+
name: Release
92+
needs: build
93+
runs-on: ubuntu-latest
94+
permissions:
95+
contents: write
96+
97+
steps:
98+
- name: Download all artifacts
99+
uses: actions/download-artifact@v4
100+
with:
101+
merge-multiple: true
102+
103+
- name: Create release
94104
uses: softprops/action-gh-release@v2
95105
with:
96106
tag_name: ${{ github.ref_name }}
107+
name: 🎉 ${{ github.ref_name }}
108+
body: |
109+
## 新增
110+
- 新增内容
111+
112+
## 优化
113+
- 优化内容
114+
115+
## 修复
116+
- 修复内容
97117
draft: true
98-
files: subtitle-renamer_${{ github.ref_name }}_windows_x64.zip
118+
files: |
119+
*.dmg
120+
*.zip

icons/dmg-background.png

274 KB
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "subtitle-renamer",
33
"private": true,
4-
"version": "2.0.2",
4+
"version": "2.0.3",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src/tauri.conf.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@
8888
"../icons/128x128@2x.png",
8989
"../icons/icon.icns",
9090
"../icons/icon.ico"
91-
]
91+
],
92+
"macOS": {
93+
"dmg": {
94+
"background": "../icons/dmg-background.png",
95+
"windowSize": { "width": 660, "height": 400 },
96+
"appPosition": { "x": 170, "y": 185 },
97+
"applicationFolderPosition": { "x": 490, "y": 185 }
98+
}
99+
}
92100
}
93101
}

ui/components/button.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function Button({ variant = "default", disabled, children, className, ...
77
: "bg-background hover:bg-background-dark/50 active:bg-background-dark/70 border-b-muted active:border-border/70",
88
primary: disabled
99
? "text-secondary/70 bg-muted/70 border-transparent"
10-
: "text-background bg-accent hover:bg-accent/90 active:bg-accent/80 border-transparent border-b-secondary/70 active:border-b-secondary/20"
10+
: "text-background dark:text-white bg-accent hover:bg-accent/90 active:bg-accent/80 border-transparent border-b-secondary/70 dark:border-b-muted/70 active:border-b-secondary/20"
1111
}
1212

1313
return (

ui/components/switch.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function Switch({ checked, onChange }) {
1919
<div
2020
className={cn(
2121
"size-3.5 shadow-sm rounded-full transition-all group-active:w-5 group-active:scale-y-95",
22-
checked ? "bg-background shadow-primary/20" : "bg-secondary/70 shadow-transparent"
22+
checked ? "bg-background dark:bg-white shadow-primary/20" : "bg-secondary/70 shadow-transparent"
2323
)}
2424
/>
2525
</button>

ui/components/toast.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ const DURATION_TIME = 2000
66

77
export function toast({ title, description, type }, toastOptions) {
88
const itemType = {
9-
success: "bg-green-50 text-green-900",
10-
warning: "bg-yellow-50 text-yellow-900",
11-
error: "bg-red-50 text-red-900"
9+
success: "!bg-[#DFF7DD] text-green-900 dark:!bg-[#2F3D1C] dark:text-primary",
10+
warning: "!bg-[#FFF4CE] text-yellow-900 dark:!bg-[#433618] dark:text-primary",
11+
error: "!bg-[#FDE7E9] text-red-900 dark:!bg-[#442724] dark:text-primary"
1212
}
1313

1414
const itemIcon = {
1515
loading: <CircleNotchIcon className="size-5 animate-spin" />,
16-
success: <CheckCircleIcon weight="fill" className="size-5 text-green-700" />,
17-
warning: <WarningCircleIcon weight="fill" className="size-5 text-yellow-700" />,
18-
error: <XCircleIcon weight="fill" className="size-5 text-red-700" />
16+
success: <CheckCircleIcon weight="fill" className="size-5 text-green-700 dark:text-green-400" />,
17+
warning: <WarningCircleIcon weight="fill" className="size-5 text-yellow-700 dark:text-yellow-400" />,
18+
error: <XCircleIcon weight="fill" className="size-5 text-red-700 dark:text-red-400" />
1919
}
2020

2121
return sonnerToast.custom((id) => (

ui/globals.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
@theme {
44
--color-accent: light-dark(#1DA0E2, #1DA0E2);
55

6-
--color-primary: light-dark(hsl(0 0 20), hsl(0 0 100));
7-
--color-secondary: light-dark(hsl(0 0 20 / 0.6), hsl(0 0 1 / 0.6));
8-
--color-muted: light-dark(hsl(0 0 20 / 0.24), hsl(0 0 1 / 0.6));
6+
--color-primary: light-dark(hsl(0 0 20), hsl(0 0 90));
7+
--color-secondary: light-dark(hsl(0 0 20 / 0.6), hsl(0 0 90 / 0.5));
8+
--color-muted: light-dark(hsl(0 0 20 / 0.24), hsl(0 0 90 / 0.2));
99

1010
--color-border: light-dark(hsl(0 0 0 / 0.1), hsl(0 0 100 / 0.1));
11-
--color-background: light-dark(hsl(0 0 100), hsl(0 0 0));
12-
--color-background-dark: light-dark(hsl(0 0 96), hsl(0 0 4));
11+
--color-background: light-dark(hsl(0 0 100), hsl(0 0 12));
12+
--color-background-dark: light-dark(hsl(0 0 96), hsl(0 0 20));
1313

1414
--color-error: light-dark(#FB2C37, #FF6467);
1515
}

ui/pages/settings-developer.jsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { resetConfig } from "@/utils/config"
44
import { SettingsContent, SettingsTitle, SettingsCard, SettingsItem } from "@/components/settings"
55
import { toast } from "@/components/toast"
66
import { Button } from "@/components/button"
7-
import { FolderOpenIcon, ArrowClockwiseIcon } from "@phosphor-icons/react"
7+
import { FolderOpenIcon, ArrowClockwiseIcon, BellRingingIcon } from "@phosphor-icons/react"
88

99
export function DeveloperSetting() {
1010
const handleOpenConfig = async () => {
@@ -40,6 +40,23 @@ export function DeveloperSetting() {
4040
<Button onClick={handleResetConfig}>重置</Button>
4141
</SettingsItem>
4242
</SettingsCard>
43+
44+
{import.meta.env.DEV && (
45+
<>
46+
<SettingsTitle title="通知测试" />
47+
48+
<SettingsCard>
49+
<SettingsItem title="发送通知" subtitle="点击后立即发送 Toast 通知" icon={<BellRingingIcon />}>
50+
<div className="flex gap-2">
51+
<Button onClick={() => toast.success({ title: "单行标题" })}>成功</Button>
52+
<Button onClick={() => toast.warning({ title: "单行标题" })}>警告</Button>
53+
<Button onClick={() => toast.error({ title: "多行标题", description: "多行多行多行多行多行多行多行内容" })}>错误</Button>
54+
<Button onClick={() => toast.promise(new Promise((r) => setTimeout(r, 1500)), { loading: { title: "加载中..." }, success: { title: "加载完成" } })}>加载</Button>
55+
</div>
56+
</SettingsItem>
57+
</SettingsCard>
58+
</>
59+
)}
4360
</SettingsContent>
4461
)
4562
}

ui/pages/settings-general.jsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { SettingsContent, SettingsTitle, SettingsCard, SettingsItem } from "@/co
33
import { Select } from "@/components/select"
44
import { Combobox } from "@/components/combobox"
55
import { Switch } from "@/components/switch"
6-
import { SunIcon, FrameCornersIcon, FileDashedIcon, TextAaIcon, CopyIcon, TrashIcon, FileArchiveIcon } from "@phosphor-icons/react"
6+
import { SunIcon, FrameCornersIcon, ArrowsClockwiseIcon, ProhibitIcon, FileDashedIcon, TextAaIcon, CopyIcon, TrashIcon, FileArchiveIcon } from "@phosphor-icons/react"
7+
import { Input } from "@/components/input"
78

89
export function GeneralSetting() {
910
const { config, saveConfig } = useConfig()
@@ -39,17 +40,39 @@ export function GeneralSetting() {
3940
</SettingsItem>
4041
</SettingsCard>
4142

42-
<SettingsTitle title="字幕检测" />
43+
<SettingsTitle title="文件添加设置" />
4344

4445
<SettingsCard>
45-
<SettingsItem title="简繁识别" subtitle="拖入文件时,自动识别字幕语言为简体或繁体。禁用后,所有字幕均视作简体字幕" icon={<FileArchiveIcon />}>
46+
<SettingsItem title="简繁识别" subtitle="添加文件时,自动识别字幕语言为简体或繁体。禁用后,所有字幕均视作简体字幕" icon={<ArrowsClockwiseIcon />}>
4647
<Switch
4748
checked={config?.subtitle?.detect_language}
4849
onChange={(checked) => saveConfig("subtitle", "detect_language", checked)}
4950
/>
5051
</SettingsItem>
5152
</SettingsCard>
5253

54+
<SettingsCard>
55+
<SettingsItem title="排除视频文件名" subtitle="是否排除文件名含特定内容的视频。使用 | 或正则表达式来匹配多个内容" icon={<ProhibitIcon />}>
56+
<Input
57+
value={config?.subtitle?.exclude_video}
58+
onChange={(e) => saveConfig("subtitle", "exclude_video", e.target.value)}
59+
placeholder="不排除视频"
60+
className="w-72"
61+
/>
62+
</SettingsItem>
63+
</SettingsCard>
64+
65+
<SettingsCard>
66+
<SettingsItem title="排除字幕文件名" subtitle="是否排除文件名含特定内容的字幕(不对压缩包生效)。使用 | 或正则表达式来匹配多个内容" icon={<ProhibitIcon />}>
67+
<Input
68+
value={config?.subtitle?.exclude_subtitle}
69+
onChange={(e) => saveConfig("subtitle", "exclude_subtitle", e.target.value)}
70+
placeholder="不排除字幕"
71+
className="w-72"
72+
/>
73+
</SettingsItem>
74+
</SettingsCard>
75+
5376
<SettingsTitle title="后缀设置" />
5477

5578
<SettingsCard>
@@ -132,7 +155,7 @@ export function GeneralSetting() {
132155
</SettingsItem>
133156
</SettingsCard>
134157

135-
<SettingsTitle title="压缩包" />
158+
<SettingsTitle title="压缩包设置" />
136159

137160
<SettingsCard>
138161
<SettingsItem title="删除字幕压缩包" subtitle="重命名完成后,是否删除字幕压缩包。仅当拖入字幕压缩包时生效" icon={<FileArchiveIcon />}>

0 commit comments

Comments
 (0)