feat: Improve Push Notification
#7667
Merged
tamaina
merged 522 commits from swn
into develop
1 year ago
Reviewers
Request review
No reviewers
Labels
Clear labels
A bug whose causes are unknown
Issues and PRs about improving accessibility
The Antennas feature
The Channels feature
The Chat feature
The Clips feature
Issues about user or admin settings
Pull requests that update a dependency file
PRs and Issues relating to docker
The Drive feature
The Galleries feature
The Groups feature
Internationalization (i18n) related issue/PR
Pull requests that update Javascript code
Issues and PRs relating to Kubernetes
The Lists/Circles feature
Issues about using Calckey with a mobile device
Issues about notifications
Issues about posts, timelines, threads
The Widgets feature
This PR edits locales other than the ja-JP one. See locales/README.md
This change breaks compatibility
This issue/PR already exists
Server side specific issue/PR
This might be a bug
This adds/improves/enhances a feature
Interface between server and client
Unexpected behavior
Being discussed or needs discussion
Documentation related issue/PR
The Federation feature
Not based on facts / Outside the scope of Calckey
The Misskey Flavored Markdown feature
This needs test code
The Pages feature
Efficiency related issue/PR
Rewriting code without changing behavior
The Room feature
Security related issue/PR
SW related issue/PR
Test related issue/PR
This is a work in progress
This will not be worked on
Issues/PRs related to AiScript
Client side specific issue/PR
Development of Calckey itself
This needs extra attention
Apply labels
1️⃣ Good First Issue
❓needs more investigation
A bug whose causes are unknown
Accessibility
Issues and PRs about improving accessibility
Antennas
The Antennas feature
Channels
The Channels feature
Chat
The Chat feature
Clips
The Clips feature
CP/Settings
Issues about user or admin settings
dependencies
Pull requests that update a dependency file
Docker
PRs and Issues relating to docker
Drive
The Drive feature
Galleries
The Galleries feature
Groups
The Groups feature
i18n
Internationalization (i18n) related issue/PR
javascript
Pull requests that update Javascript code
Kubernetes
Issues and PRs relating to Kubernetes
Lists/Circles
The Lists/Circles feature
Mobile
Issues about using Calckey with a mobile device
Notifications
Issues about notifications
Posts/timelines
Issues about posts, timelines, threads
Widgets
The Widgets feature
‼️ wrong locales
This PR edits locales other than the ja-JP one. See locales/README.md
☢️Breaking
This change breaks compatibility
♻️Duplicate
This issue/PR already exists
⚙️Server
Server side specific issue/PR
⚠️bug?
This might be a bug
✨Feature
This adds/improves/enhances a feature
🧩API
Interface between server and client
🐛Bug
Unexpected behavior
💬Discussion
Being discussed or needs discussion
📖Doc
Documentation related issue/PR
🌌Federation
The Federation feature
💴has reward
🔥high priority
🚫Invalid
Not based on facts / Outside the scope of Calckey
🙏low priority
🖍MFM
The Misskey Flavored Markdown feature
🧪needs test
This needs test code
📜Pages
The Pages feature
🐢Performance
Efficiency related issue/PR
💚Refactor
Rewriting code without changing behavior
🏠Room
The Room feature
🔒Security
Security related issue/PR
🤖Service Worker
SW related issue/PR
🧪Test
Test related issue/PR
🚧WIP
This is a work in progress
🗿Wontfix
This will not be worked on
👩💻AiScript
Issues/PRs related to AiScript
🖥️Client
Client side specific issue/PR
🛠️Dev
Development of Calckey itself
🏳️needs help
This needs extra attention
No Label
1️⃣ Good First Issue
❓needs more investigation
Accessibility
Antennas
Channels
Chat
Clips
CP/Settings
dependencies
Docker
Drive
Galleries
Groups
i18n
javascript
Kubernetes
Lists/Circles
Mobile
Notifications
Posts/timelines
Widgets
‼️ wrong locales
☢️Breaking
♻️Duplicate
⚙️Server
⚠️bug?
✨Feature
🧩API
🐛Bug
💬Discussion
📖Doc
🌌Federation
💴has reward
🔥high priority
🚫Invalid
🙏low priority
🖍MFM
🧪needs test
📜Pages
🐢Performance
💚Refactor
🏠Room
🔒Security
🤖Service Worker
🧪Test
🚧WIP
🗿Wontfix
👩💻AiScript
🖥️Client
🛠️Dev
🏳️needs help
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Set Project
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
No dependencies set.
Reference: calckey/calckey#7667
Reference in New Issue
There is no content yet.
Delete Branch 'swn'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
Summary
Resolve #6359, Resolve #6628, Resolve #6395
#7129 でgitの誤操作によりブランチが蒸発したため新規にPRを出します。
かなり長期間にわたっていますので、#7129も参照してください。
What
Service Workerのプッシュ通知を拡張し、actionsを用いて通知に反応できるようにします。
また、プッシュ通知まわりの挙動の整理もします。
Why
Service Workerのプッシュ通知でいろいろできるので
依存PR
Waiting to merge
#7605,
Merged
#7108, #7196, #7609, #7611, #7750, #7606, #7928, #7929
Changes
バグ(仕様です)
プッシュ通知のペイロードが長すぎるとブラウザのプッシュ通知エンドポイントへ送信する際にエラーとなる将来的な拡張(今回のPRでは行わない)
IndexedDBが何かの拍子に壊れるっぽくて頭を抱えている
(idb-keyvalを通して弄っているので不正な操作はしていないはず…
mark-all-as-read叩いてもインジケータが消えない
直した
再現性がないのでとりあえずパス
直ってないんじゃないかな
p1.a9z.devだと
んだけど、他のPR由来でDBがぶっ壊れてる可能性もある
他のPR由来だった
いまのところ壊れていないので、修正前のコードで作成したDBを直していないケースだったんじゃないかと思う
Misskey.jsのapiクライアントを使ったらChromiumだとエラーがでる…
謎
あ、いやなんとなく原因が分かった
https://github.com/tamaina/misskey/blob/swn/src/client/sw/operations.ts#L13
このfetchの渡し方は禁忌だった気がする
misskey.js側で
inServiceWorker
みたいなオプション実装すれば回避できるかしらSWと通常のfetchって変わらなかった気がするので特別指定しなくてもいい気もする
SerivceWorkerってwindowあったっけ?
windowはない
window省略表記すればよしなになるのか
現状window呼び出してないから大丈夫そう
https://github.com/misskey-dev/misskey.js/blob/develop/src/api.ts
でもfetch指定しなくてもIllegal invocation出たわ…
メモ: プッシュ通知のペイロードが長すぎるとブラウザのプッシュ通知エンドポイントがエラーを返すっぽい
fetchなどのビルトイン関数は変数に関数としてそのまま代入するとエラーになる(とくにChromiumでは)
なので、
のように即席関数でラップしてやると良くなった
(misskey.jsでもこれやっといたほうがいいかも?(私はもう寝るけど
起きたのでmisskey.jsにプルリク作った
https://github.com/misskey-dev/misskey.js/pull/29
webpackを使っているせいで警告されるようになった
Androidで通知が表示されないなぁと不思議に思っていたら単にサイレントモードが有効になっていただけだった
packages/client/src/scripts/get-note-summary.tsの変更は全て不要かも
clinetのscriptsって、ローカルストレージだったりVueだったりに依存している処理があるから、ServiceWorkerのコードはまるごとswパッケージにでもして分離した方が分かりやすくなりそうとちょっと思ったけどどうだろう
これやるか。Service Workerの追加はクライアントをもう一つ増やすのと変わりないので。
Failed to load the script unexpectedly
でスクリプトを起動できないんだけど…Chrome/EdgeでOS関係なく発生する、Firefoxだとちゃんと動いている
エラーコードでググったらソースコード出てきたわ
19cda129dc/third_party/blink/renderer/core/loader/modulescript/installed_service_worker_module_script_fetcher.cc (44)
ルートにself.addEventListenerが来ていないのが原因なような気はするけど、Webpackでそういうことができるのかどうかはわからない…
トップレベル(ルート)にself.addEventListenerが来るようにごにょごにょしたらいい感じに動くようになった
Service Workerのビルドにesbuildを使うようにした
🚀
766559c6e9
.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Forgejo.