mirror of
https://github.com/Jonnyan404/memos-bber.git
synced 2026-04-25 03:58: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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user