Skip to content

Commit 0c7fccb

Browse files
fix: sw, update version
1 parent 1d753ca commit 0c7fccb

4 files changed

Lines changed: 60 additions & 73 deletions

File tree

packages/webgal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webgal-engine",
3-
"version": "4.5.18",
3+
"version": "4.5.19",
44
"scripts": {
55
"dev": "vite --host --port 3000",
66
"build": "node scripts/update-engine-version.js && cross-env NODE_ENV=production tsc && vite build --base=./",

packages/webgal/public/webgal-engine.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "webgal",
3-
"version": "4.5.18",
3+
"version": "4.5.19",
44
"type": "official",
5-
"webgalVersion": "4.5.18",
5+
"webgalVersion": "4.5.19",
66
"description": "界面美观、功能强大、易于开发的全新网页端视觉小说引擎",
77
"descriptions": {
88
"en": "A brand new web Visual Novel engine with a beautiful interface, powerful features, and easy development",

packages/webgal/public/webgal-serviceworker.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,33 @@ function isCriticalGameRequest(request) {
3434
return CRITICAL_PATHS.some((prefix) => url.pathname.startsWith(prefix));
3535
}
3636

37-
async function cacheFirst(request) {
37+
// Stale-while-revalidate: return cached response immediately, then update cache in background.
38+
async function staleWhileRevalidate(request) {
3839
const cache = await caches.open(CACHE_NAME);
3940
const cached = await cache.match(request.url);
41+
42+
const fetchAndUpdate = async () => {
43+
try {
44+
const response = await fetch(request);
45+
if (response.ok) {
46+
await cache.put(request.url, response.clone());
47+
}
48+
return response;
49+
} catch (e) {
50+
return null;
51+
}
52+
};
53+
4054
if (cached) {
41-
logOnce(`hit:${request.url}`, 'cache hit:', new URL(request.url).pathname);
55+
logOnce(`hit:${request.url}`, 'cache hit (revalidating):', new URL(request.url).pathname);
56+
// Revalidate in background — don't await
57+
fetchAndUpdate();
4258
return cached;
4359
}
4460

61+
// No cache — must wait for network
4562
const response = await fetch(request);
46-
if (response.ok && response.status === 200) {
63+
if (response.ok) {
4764
await cache.put(request.url, response.clone());
4865
logOnce(`cache:${request.url}`, 'cached:', new URL(request.url).pathname);
4966
}
@@ -62,7 +79,7 @@ self.addEventListener('fetch', (event) => {
6279
}
6380

6481
event.respondWith(
65-
cacheFirst(request).catch(() => {
82+
staleWhileRevalidate(request).catch(() => {
6683
return fetch(request);
6784
}),
6885
);

releasenote.md

Lines changed: 36 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,31 @@
88

99
#### 新功能
1010

11-
-when 指令支持字符串条件判断,变量表达式中的空白会自动裁剪
11+
getUserInput 支持正则校验参数 rule / ruleFlag / ruleText / ruleButtonText,可在输入不匹配时弹窗提示,ruleText 中可用 $0 引用用户输入值
1212

13-
解析器新增行内注释保留能力,语句可读取 inlineComment 字段
13+
changeFigure 支持 skin 参数,可切换 Spine 模型皮肤
1414

15-
changeFigure 支持 blendMode 参数,可设置 normal / add / multiply / screen 混合模式
15+
setTransform 新增 oldFilm / dotFilm / reflectionFilm / glitchFilm / rgbFilm / godrayFilm 滤镜属性
1616

17-
黑边填充背景切换支持淡入淡出过渡
17+
添加引擎描述文件 webgal-engine.json 及版本自动同步机制
1818

19-
模板样式文件(标题、文本框、选项)会在启动时预加载并支持热更新
19+
标题按钮文字支持多层渲染(outer / inner),方便模板自定义描边与阴影效果
2020

21-
文本框行高支持通过全局变量 Line_height 调整
22-
23-
鉴赏模式中解锁的 CG / BGM 会立即写入本地存储,减少异常退出导致的解锁丢失
21+
内置默认字体更换为「资源圆体」(Resource Han Rounded)
2422

2523
#### 修复
2624

27-
修复语音播放时音量倍率在切换语音后可能不正确的问题
28-
29-
修复切换语音资源时口型分析节点未重建导致口型动画异常的问题
30-
31-
修复 changeBg / changeFigure 的退出动画与时长设置在部分场景不生效或残留的问题
32-
33-
修复 keep 动画停止与 timeline 单关键帧时的异常行为
25+
修复 removeAnimationByTargetKey 无法移除同一目标上多个动画的问题
3426

35-
修复透明度滤镜场景下默认进退场动画与 alpha 恢复不一致的问题
27+
修复 setEffect 前未先移除旧动画导致效果叠加异常的问题
3628

37-
修复 setTransform 在透明度转换场景下误修改源 transform,导致后续变换异常的问题
29+
修复自动播放与快进按钮状态在部分操作后与实际状态不同步的问题
3830

39-
修复 Live2D blink / focus 在部分参数更新时被错误覆盖的问题
31+
修复 Safari / iOS 下视口大小与缩放异常的问题
4032

41-
修复解析器在行末注释与转义分号场景下的语句解析问题
33+
重构 Service Worker,采用 cache-first 策略缓存游戏关键资源,修复旧缓存逻辑缺陷
4234

43-
修复鉴赏模式数据更新与持久化问题,并在清除全部数据时保留 config 初始全局变量
44-
45-
修复鉴赏界面 CG 导航溢出及 Logo 淡出期间背景闪烁问题
35+
修复标题界面样式与布局问题
4636

4737
<!-- English Translation -->
4838
## Release Notes
@@ -55,41 +45,31 @@ changeFigure 支持 blendMode 参数,可设置 normal / add / multiply / scree
5545

5646
#### New Features
5747

58-
The -when command now supports string condition checks, and whitespace in expressions is trimmed automatically
59-
60-
The parser now preserves inline comments, exposed via the inlineComment field on sentences
48+
getUserInput now supports regex validation via rule / ruleFlag / ruleText / ruleButtonText arguments, showing a dialog when input does not match; ruleText supports $0 to reference the user's input value
6149

62-
changeFigure now supports a blendMode argument with normal / add / multiply / screen modes
50+
changeFigure now supports a skin argument for switching Spine model skins
6351

64-
Black-border fill background switching now supports fade transitions
52+
setTransform adds new filter properties: oldFilm / dotFilm / reflectionFilm / glitchFilm / rgbFilm / godrayFilm
6553

66-
Template style files (title, textbox, choose) are preloaded on startup and support hot style refresh
54+
Added engine description file webgal-engine.json and automatic version synchronization mechanism
6755

68-
Textbox line height can now be controlled through the global variable Line_height
56+
Title button text now supports layered rendering (outer / inner) for easier template customization of strokes and shadows
6957

70-
Unlocked CG / BGM entries in appreciation mode are now persisted immediately to local storage to reduce data loss on unexpected exit
58+
Default built-in font changed to Resource Han Rounded (资源圆体)
7159

7260
#### Fixes
7361

74-
Fixed incorrect vocal volume scaling after switching voice playback
75-
76-
Fixed lip-sync analyzer nodes not being reconnected when switching vocal media sources
77-
78-
Fixed cases where changeBg / changeFigure exit animations and durations did not apply correctly or were left behind
62+
Fixed removeAnimationByTargetKey not removing all animations sharing the same target key
7963

80-
Fixed abnormal behavior when stopping keep animations and when timeline animations had only a single keyframe
64+
Fixed old animations not being removed before setEffect, causing effects to stack incorrectly
8165

82-
Fixed inconsistencies in default enter/exit fades and alpha restoration under alpha-filter-based rendering
66+
Fixed auto-play and fast-forward button states becoming out of sync with actual state after certain operations
8367

84-
Fixed source transform data being mutated during alpha conversion in setTransform paths, which caused later transforms to behave incorrectly
68+
Fixed viewport sizing and scaling issues on Safari / iOS
8569

86-
Fixed Live2D blink / focus updates incorrectly overwriting partial parameter updates
70+
Refactored Service Worker with a cache-first strategy for critical game assets, fixing legacy caching logic issues
8771

88-
Fixed parser issues with end-of-line comments and escaped semicolon scenarios
89-
90-
Fixed appreciation data update/persistence issues, and now preserves initial config globals when clearing all data
91-
92-
Fixed CG navigation overflow in Extra UI and logo fade background flicker
72+
Fixed title screen style and layout issues
9373

9474
<!-- Japanese Translation -->
9575
## リリースノート
@@ -102,38 +82,28 @@ Fixed CG navigation overflow in Extra UI and logo fade background flicker
10282

10383
#### 新機能
10484

105-
-when コマンドで文字列条件の判定に対応し、式中の空白を自動でトリミングするようになりました
85+
getUserInput で正規表現バリデーション引数 rule / ruleFlag / ruleText / ruleButtonText をサポートし、入力が一致しない場合にダイアログを表示できるようになりました。ruleText 内で $0 を使用してユーザー入力値を参照できます
10686

107-
パーサーが行内コメントを保持するようになり、文オブジェクトの inlineComment から参照できます
87+
changeFigure で skin 引数をサポートし、Spine モデルのスキンを切り替えられるようになりました
10888

109-
changeFigure で blendMode 引数をサポートし、normal / add / multiply / screen を指定できます
89+
setTransform に oldFilm / dotFilm / reflectionFilm / glitchFilm / rgbFilm / godrayFilm フィルター属性を追加しました
11090

111-
黒縁塗りつぶし背景の切り替えにフェード遷移を追加しました
91+
エンジン記述ファイル webgal-engine.json およびバージョン自動同期メカニズムを追加しました
11292

113-
テンプレートのスタイルファイル(タイトル・テキストボックス・選択肢)を起動時にプリロードし、スタイル更新にも追従します
93+
タイトルボタンのテキストが多層レンダリング(outer / inner)に対応し、テンプレートでのストロークやシャドウのカスタマイズが容易になりました
11494

115-
テキストボックスの行間をグローバル変数 Line_height で調整できるようになりました
116-
117-
鑑賞モードで解放した CG / BGM を即時にローカル保存するようにし、異常終了時の取りこぼしを減らしました
95+
デフォルト内蔵フォントを「資源圓體」(Resource Han Rounded) に変更しました
11896

11997
#### 修正
12098

121-
ボイス切り替え後に音量倍率が正しく反映されない問題を修正しました
122-
123-
ボイス音源の切り替え時に口パク解析ノードが再接続されず、口パクが乱れる問題を修正しました
124-
125-
changeBg / changeFigure の退場アニメーションと時間設定が一部で効かない、または残留する問題を修正しました
126-
127-
keep アニメーション停止時と timeline が単一キーフレームの場合の異常動作を修正しました
128-
129-
アルファフィルター適用時にデフォルト入退場フェードと透明度復元が一致しない問題を修正しました
99+
removeAnimationByTargetKey が同一ターゲット上の複数アニメーションを削除できない問題を修正しました
130100

131-
setTransform の透明度変換処理で元の transform が不正に書き換わり、後続の変換が崩れる問題を修正しました
101+
setEffect の前に旧アニメーションが削除されず、エフェクトが不正に重複する問題を修正しました
132102

133-
Live2D の blink / focus で一部パラメータ更新時に設定が不正に上書きされる問題を修正しました
103+
一部操作後に自動再生・早送りボタンの状態が実際の状態と同期しなくなる問題を修正しました
134104

135-
行末コメントやエスケープされたセミコロンを含む場合のパーサー解析不具合を修正しました
105+
Safari / iOS でのビューポートサイズとスケーリングの異常を修正しました
136106

137-
鑑賞モードのデータ更新・永続化の不具合を修正し、全データ削除時に config 初期グローバル変数を保持するようにしました
107+
Service Worker をリファクタリングし、ゲームの重要なアセットに cache-first 戦略を採用、レガシーキャッシュロジックの不具合を修正しました
138108

139-
Extra 画面の CG ナビゲーションのはみ出しと、ロゴフェード時の背景ちらつきを修正しました
109+
タイトル画面のスタイルとレイアウトの問題を修正しました

0 commit comments

Comments
 (0)