Commit Graph
36 Commits
Author SHA1 Message Date
Your NameandClaude Sonnet 5 4e8f45d7d8 路由从 hash 换成 History API(pushState/replaceState/popstate),不再依赖 location.hash
HashNavigation 改名 Navigation(src/lib/navigation.js),接口不变,内部改用真实路径:
parseUrlHash/composeUrlHash 改名 parseUrl/composeUrl;navigateTo/navigateReplace 改调
pushState/replaceState 后手动派发 popstate(pushState/replaceState 不会像赋值 location.hash
那样自动触发事件,这里复用 navigateReplace 早就在用的同一个手动 dispatch 手法);goBack()
不用改,history.back() 本来就是真实浏览器历史机制。新增 Navigation.currentUrl() 替代调用方
原本直接读的 window.location.hash(这个类从来没包装过这个读取)。

一处需要专门处理的边界情况:当 path[0] 是空字符串("不选中侧栏视图、只开一个会话"这个仓库里
的合法状态)时,拼出的真实路径开头会变成双斜杠,被浏览器当协议相对地址解析、试图跳到一个叫
会话id的host,pushState 直接抛 SecurityError。composeUrl/parseUrl 内部用占位 token "_" 处理
这种情况,对外的调用方(19个文件)完全无感。

tinode-web.jsx 的 handleHashRoute 改名 handleRouteChange,监听从 hashchange 换成 popstate;
service-worker.js 的推送通知点击跳转手动改写成同样的路径格式(这个文件在打包之外单独执行,
没法 import Navigation)。index.html/index-dev.html 加了 <base href="/">——所有静态资源引用
都是相对路径,hash 路由下页面路径永远是 /,换真实路径后深层地址刷新会按当前目录解析出错误
资源地址导致白屏,这一行是标准修法。nginx.conf 的 try_files 兜底规则本来就适用两种路由,只
更新了注释。

实机验证:地址栏不再有 #;点击会话/设置等各类视图正常跳转;浏览器前进后退和应用内"返回"
按钮都正常;收藏页内部的类型 tab 切换(navigateReplace)确认不产生新的历史记录;在会话页/
个人中心页刷新、直接用完整深层路径打开新标签页都能正确恢复到位,资源正常加载不白屏。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 21:00:39 +08:00
or-else 7bf3fa71d6 partially dependencies updated 2026-07-04 15:19:03 +03:00
or-else 3bfabc90f3 add missing vi translations, rearrange language imports in alpha order 2026-03-02 14:06:40 +03:00
amit d674deeca6 feat(translation): Add Vietnamese (vi) translation 2026-03-02 15:07:52 +07:00
or-else 0f8d94ac2f wallpapers 2025-10-18 15:32:14 +03:00
or-else e641dc0d32 automatically add dir="rtl" to <html> tag when the language is RTL 2025-06-06 10:41:10 +03:00
or-else e8b48dfd84 hook up arabic translation, rebuild 2025-05-28 13:05:16 +03:00
or-else d128cec90d add Thai and (missing) Ukrainian loaders, mention Thai translation 2023-09-25 14:13:17 -07:00
or-else 192a3d4ec2 don't crash if FIREBASE_INIT is not defined 2023-03-19 15:14:00 -07:00
or-else 08d4c08cbc optional integration of google analytics 2023-01-12 20:15:08 -08:00
or-else 6aca7e527e removed unused import 2022-12-08 14:07:24 -08:00
or-else f6cd3048e1 on-demand translation loading works now 2022-12-05 17:18:47 -08:00
or-else 4ad723b854 the app restored: "runtimeChunk: single" was the problem 2022-12-05 15:26:17 -08:00
or-else 3a002f224d remove topLevelAwait experiment 2022-12-05 09:33:56 -08:00
or-else 5fdcc65b5b does not work 2022-12-04 14:24:05 -08:00
or-else 983de97d7f removed StrictMode due to issues with double mounting of components 2022-11-20 16:20:53 -08:00
or-else a99ad81196 all dependencies updated to latest, including breaking changes 2022-11-17 11:43:28 -08:00
or-else 7e3a616983 fix for #91 (typo) 2022-03-15 09:04:14 -07:00
or-else 7117955126 add language attribute to <html> 2021-09-16 11:31:27 -07:00
or-else d1ea1d7658 add React.StrictMode checking for devel 2021-07-07 16:35:39 -07:00
or-else f3420dc66f upgraded react-intl to 3.3 2019-09-23 15:28:22 +03:00
or-else 10bb206d51 experimenting with code splitting 2019-09-22 21:32:32 +03:00
or-else 8c4e0e9068 all components are translated now 2018-10-30 15:56:36 +03:00
or-else 48d5732c16 more components updated and translated 2018-10-27 11:55:32 +03:00
or-else 71bbfb4fdd more fixes 2018-10-26 16:36:30 +03:00
or-else 00a54ac0ee more fixes 2018-10-25 18:57:13 +03:00
or-else e139c1371e login page is displayed now 2018-10-25 14:02:53 +03:00
or-else 358f9eb970 webpack works now 2018-10-25 11:19:43 +03:00
or-else 7dead5b14d switching to webpack 2018-10-24 17:14:07 +03:00
or-else 57fa378f4d apply es6 -> es5 transform 2018-10-02 14:17:09 +03:00
or-else f9725cb06a package TinoeWeb as npm module 2018-09-14 16:13:41 +03:00
or-else 03db847d48 last fix for the attachments, bump version 2018-09-12 17:19:11 +03:00
or-else 7d01356be7 moving contact management to <TinodeWeb /> 2018-09-08 19:51:50 +03:00
or-else aafa0f74d5 trying to package the webapp 2018-09-04 19:28:46 +03:00
or-else 40000cfa44 try to make this work for both devel and prod 2018-09-04 16:37:55 +03:00
or-else cf849d6412 rearranging files 2018-08-24 16:00:07 +03:00