mirror of
https://github.com/Jonnyan404/memos-bber.git
synced 2026-04-24 19:48:37 +09:00
Support Memos v0.27 and improve API parsing
Bump supported Memos version to v0.27 across locales, README changelog, and manifest (version and version_name). Improve memos API compatibility: prefer and return trimmed username when present, handle non-numeric trailing name segments safely, and encode userid in the user-scoped memos URL to avoid issues with special characters.
This commit is contained in:
@@ -5,6 +5,7 @@ Chrome 应用商店:<https://chrome.google.com/webstore/detail/memos-bber/cbhj
|
||||
一个通过浏览器插件发布 [Memos](https://usememos.com/) 的插件。基于 iSpeak-bber 修改,原作者为 [DreamyTZK](https://www.antmoe.com/)。
|
||||
|
||||
## 更新日志
|
||||
- 20260421 更新匹配 0.27.x
|
||||
- 20260325 优化语言按钮样式
|
||||
- 20260323 优化中文显示效果
|
||||
- 20260322 适配移动端竖屏窗口
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "Save"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "Compatible with Memos v0.15.0 - 0.26.x"
|
||||
"message": "Compatible with Memos v0.15.0 - 0.27.x"
|
||||
},
|
||||
"placeApiUrl":{
|
||||
"message": "Memos site URL"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "保存"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "Memos v0.15.0 - 0.26.x に対応"
|
||||
"message": "Memos v0.15.0 - 0.27.x に対応"
|
||||
},
|
||||
"placeApiUrl": {
|
||||
"message": "Memos サイトURL"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "저장"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "Memos v0.15.0 - 0.26.x 호환"
|
||||
"message": "Memos v0.15.0 - 0.27.x 호환"
|
||||
},
|
||||
"placeApiUrl": {
|
||||
"message": "Memos 사이트 URL"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"message": "保存"
|
||||
},
|
||||
"supportedMemosVersion": {
|
||||
"message": "兼容 Memos v0.15.0 - 0.26.x"
|
||||
"message": "兼容 Memos v0.15.0 - 0.27.x"
|
||||
},
|
||||
"placeApiUrl":{
|
||||
"message": "请填入 Memos 主页网址"
|
||||
|
||||
@@ -11,12 +11,19 @@
|
||||
return Number(user.id)
|
||||
}
|
||||
|
||||
if (typeof user.username === 'string' && user.username.trim() !== '') {
|
||||
return user.username.trim()
|
||||
}
|
||||
|
||||
const name = user.name || (user.user && user.user.name)
|
||||
if (typeof name === 'string') {
|
||||
const m = name.match(/\busers\/(\d+)\b/)
|
||||
if (m) return Number(m[1])
|
||||
const last = name.split('/').pop()
|
||||
if (last && !Number.isNaN(Number(last))) return Number(last)
|
||||
if (last) {
|
||||
if (!Number.isNaN(Number(last))) return Number(last)
|
||||
if (last.trim() !== '') return last.trim()
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
@@ -88,7 +95,7 @@
|
||||
// the full set (including private), which affects tag extraction.
|
||||
// Newer versions may not expose the user-scoped endpoint, so we fallback by 404/405.
|
||||
const urlUserScoped = info.userid
|
||||
? info.apiUrl + 'api/v1/users/' + info.userid + '/memos' + qs
|
||||
? info.apiUrl + 'api/v1/users/' + encodeURIComponent(String(info.userid)) + '/memos' + qs
|
||||
: null
|
||||
const urlGlobal = info.apiUrl + 'api/v1/memos' + qs
|
||||
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"manifest_version": 3,
|
||||
"name": "__MSG_extName__",
|
||||
"default_locale": "en",
|
||||
"version": "2026.04.11",
|
||||
"version_name": "Supports 0.15.0 - 0.26.x",
|
||||
"version": "2026.04.21",
|
||||
"version_name": "Supports 0.15.0 - 0.27.x",
|
||||
"action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": "assets/logo_24x24.png",
|
||||
|
||||
Reference in New Issue
Block a user