reuixiy / io-oi.me

Blog of reuixiy!
https://io-oi.me
Other
99 stars 40 forks source link

添加 Service Worker 的更新通知 #108

Open reuixiy opened 3 years ago

reuixiy commented 3 years ago

看到 https://devdocs.io 获取到新版本后,会有一个刷新的通知,刷新后又有一个通知,内容是 Change log,感觉这样设计挺不错的

应该可以通过 Hugo 将 commit message 和 commit hash 放在 JS 或 JSON 中,然后 check

鸡肋的极简需手动刷新方可浏览最新版 Service Worker 终于要升级了,顺便把 MemE 的 JS 重写一遍?把 native JS bundler https://github.com/reuixiy/hugo-theme-meme/issues/237 用上


不过,如果用户很久之后再次打开我的博客后,看到的更新通知就是不全的了,因为更新通知只有最新的一条 commit message。

也就是说,可以通过判断用户

来控制通知的 commit message 的条数,生产一个定制的更新说明通知

这样生成的数据大概可以是 array of objects

{
  commits: [
    {
      hash: commitHash,
      msg: commitMsg,
    },
    {
      hash: ,
      msg: ,
    },
    ...
  ]
}

(也许可以直接通过 GitHub 的 API)

reuixiy commented 3 years ago

PWA related links updates