Commit Graph
69 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
Your Name 693265658f fix(导航): 关闭聊天/信息面板改为真实返回,不再新增历史记录
用户反馈:从会话列表打开聊天A,点页面自己的"返回"关掉聊天,再打开聊天B,这时候点
浏览器的返回键,会先回到列表,再点一次返回又跳回了聊天A——因为"关闭"这个动作和"打开"
一样都在往浏览器历史里push新记录,而不是弹出(pop)"打开"时push的那条,导致聊天A那条
记录一直遗留在历史栈里,多按一次返回就会被重新翻出来。

两处受影响、同一根因:
- tinode-web.jsx 的 handleHideMessagesView(移动端聊天页左上角"←",messages-view.jsx
  的#hide-message-view)——打开聊天(handleTopicSelected)是真实push,关闭时原来无条件
  再push一条"没有话题"的状态,现在改成先尝试HashNavigation.goBack(),找不到可回退的
  历史才退回原来的push方式。
- info-view.jsx 的 handleBackNavigate(旧版InfoView自己的返回/关闭按钮,目前只有"已
  保存的消息"这一个话题还在用它,好友/群的资料页已经在更早的章节改用真正修过返回逻辑
  的friend-settings/group-settings)——同样的问题,同样的修法。

已在浏览器验证:连续"开聊天A→点返回关闭→开聊天B"后,浏览器返回键能一次性回到聊天A
从未存在过一样,不会再被重新翻出来;InfoView的关闭按钮点击后hash是异步变化的(真实
history.back()的特征),不再是原来同步的push。
2026-09-06 12:29:56 +08:00
or-else a54ae70746 split out a few modules, handle esc key 2026-01-19 15:41:33 +03:00
or-else 0f8d94ac2f wallpapers 2025-10-18 15:32:14 +03:00
or-else 8ca7f5cd3e support for showing the number of subscribers 2025-09-29 20:51:51 +03:00
or-else c70e5ebf7e fix late initialization of InfoView component 2025-09-24 19:38:29 +03:00
or-else 4818ee7a25 support for pinning topics; truncate text with support for RTL languages 2025-09-20 18:18:01 +03:00
or-else b1acfecd4f fixing translations 2025-03-12 19:40:33 +03:00
or-else 11436a80ee support fro unique aliases, https://github.com/tinode/chat/issues/446 2025-03-04 13:05:51 +03:00
or-else 6f05fd102f merge devel 2025-02-23 11:05:57 +03:00
or-else 4897d63029 bug fix: incorrect QR code in topic info 2025-02-23 11:05:00 +03:00
or-else 30bf77d4ba sending messages to self works 2025-02-16 22:06:02 +03:00
or-else 9eaa172030 add QR code display 2024-02-02 16:26:49 -08:00
or-else aa5e9ef5c7 adding credential editing 2023-01-27 16:18:23 -08:00
or-else ce19ebbbdd fix for https://github.com/tinode/chat/issues/825 2023-01-23 10:18:22 -08:00
or-else 72ec3b51a0 edited for code style consistency 2022-11-19 17:14:43 -08:00
or-else 5006a6fb34 partial fix for avatar uploads 2022-08-25 18:50:11 -10:00
or-else a90f1f4fef fix crash on missing AccessMode module 2022-07-19 08:54:49 -07:00
aforge 706a7e0aaa Remaining code review items. 2022-04-28 22:00:11 -07:00
or-else e938c909a1 merge next 2022-04-25 14:02:35 -07:00
aforge c4d4aa77db Video calls: some more cleaup. 2022-04-22 20:43:10 -07:00
or-else 601c048ea5 fix broken spam reporting 2022-03-19 09:18:01 -07:00
or-else c5011a4383 fix missing reply menu 2022-03-16 16:34:46 -07:00
or-else 609d3e3a9f audio messages are correctly formed and sent 2022-03-11 15:42:07 -08:00
or-else ae197dac8f translation for Archived: 2021-08-22 17:37:46 -07:00
or-else c522b90150 a bunch of small fixes in refactored UI 2021-08-19 16:21:16 -07:00
or-else 2cc2258682 fixed bugs in tags editing 2021-08-18 19:51:19 -07:00
or-else d22b35aacc a couple more visual and logical fixes 2021-08-14 16:24:45 -07:00
or-else d6ca3f9f3c fix editing permissions 2021-08-13 20:35:39 -07:00
or-else 58e319b58e kind of works, no crashes, but inefficient and not everything is refreshed 2021-08-09 14:03:33 -07:00
or-else 1c0b464bed more or less complete 2021-08-08 18:51:25 -07:00
or-else fcb61dcc3b a ton more refactoring 2021-08-07 15:34:22 -07:00
or-else 6d4ff9d625 a lot of refactoring of topic-info 2021-08-06 14:58:05 -07:00
or-else 642821db9f refactoring for better topic and account editing 2021-08-05 16:32:13 -07:00
or-else 094173fe02 refactoring info-view into reusable components 2021-07-18 19:26:34 -07:00
or-else 0afef6c587 fixing display of avatars by URL 2021-07-15 17:29:06 -07:00
or-else 4219e47529 making uploads work 2021-07-14 16:06:37 -07:00
or-else e30868c072 wip: out of band avatars 2021-07-01 14:19:28 -07:00
or-else 649d6e0494 trusted badges work as expected 2021-06-27 18:20:45 -07:00
or-else 74d5473a8b adding support for out of band avatars 2021-05-10 11:38:53 -07:00
or-else 02e1a28e89 rename vcard to theCard 2021-05-09 14:12:46 -07:00
or-else c01f80c248 more generic names of some css classes 2021-04-06 17:34:10 -07:00
or-else 55c24f884e Merge branch 'devel' into next 2021-01-28 17:18:40 -08:00
or-else 010665284b firmatjs requires exlicit declarations everywhere now 2021-01-27 18:21:06 -08:00
or-else 9c69b7129c tinode setup is async now 2021-01-24 17:41:41 -08:00
or-else e05e75ed28 use server-provided limits instead of hardcoded ones 2020-12-17 20:14:03 -08:00
or-else 28fd6a7236 fix channel permissions & disable deleting messages 2020-08-25 17:44:14 -07:00
or-else 45c6cf22ff support for channels 2020-08-01 15:10:37 -07:00
or-else 6be7b87173 small refactoring of enabled permissions in topic 2020-04-15 09:45:15 +03:00
or-else 8c1b926008 enforce maximum title length for topics and users 2019-11-06 11:25:07 +03:00