From 5b0483007ae4fa03380278662bdd415fba14c118 Mon Sep 17 00:00:00 2001 From: Windyskr <54269955+Windyskr@users.noreply.github.com> Date: Wed, 5 Aug 2026 00:30:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=B9=E9=BD=90=20Memos=200.29=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome/js/compat/memosApi.adapter.js | 25 +++++++++++-------------- edge/js/compat/memosApi.adapter.js | 25 +++++++++++-------------- firefox/js/compat/memosApi.adapter.js | 25 +++++++++++-------------- 3 files changed, 33 insertions(+), 42 deletions(-) diff --git a/chrome/js/compat/memosApi.adapter.js b/chrome/js/compat/memosApi.adapter.js index 333ced2..13d0f95 100644 --- a/chrome/js/compat/memosApi.adapter.js +++ b/chrome/js/compat/memosApi.adapter.js @@ -264,15 +264,10 @@ return } - if (global.MemosApiModern) { - global.MemosApiModern.fetchMemosWithFallback( - info, - '?pageSize=1000', - function (data) { - if (success) success(collectTags(info, extractMemos(data))) - }, - fail - ) + if (global.MemosApiV023) { + global.MemosApiV023.listMemos(info, { pageSize: 1000 }, function (data) { + if (success) success(collectTags(info, extractMemos(data))) + }, fail) } } @@ -369,10 +364,12 @@ } function uploadFile(file, options, success, fail) { - const oldName = String(file && file.name ? file.name : 'upload').split('.') - const fileExt = String(file && file.name ? file.name : '').split('.').pop() + const sourceName = String(file && file.name ? file.name : 'upload') + const lastDot = sourceName.lastIndexOf('.') + const filenameBase = lastDot > 0 ? sourceName.slice(0, lastDot) : sourceName + const fileExt = lastDot > 0 ? sourceName.slice(lastDot) : '' const now = global.dayjs().format('YYYYMMDDHHmmss') - const nextName = oldName[0] + '_' + now + (fileExt ? '.' + fileExt : '') + const nextName = filenameBase + '_' + now + fileExt if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) { global.MemosApiV020V021.uploadResourceBlob( @@ -421,9 +418,9 @@ } requestJson({ - url: info.apiUrl + 'api/v1/' + memoName, + url: info.apiUrl + 'api/v1/' + memoName + '?updateMask=state', type: 'PATCH', - data: JSON.stringify({ state: 'ARCHIVED' }), + data: JSON.stringify({ name: memoName, state: 'ARCHIVED' }), contentType: 'application/json', dataType: 'json', headers: { Authorization: 'Bearer ' + info.apiTokens } diff --git a/edge/js/compat/memosApi.adapter.js b/edge/js/compat/memosApi.adapter.js index 333ced2..13d0f95 100644 --- a/edge/js/compat/memosApi.adapter.js +++ b/edge/js/compat/memosApi.adapter.js @@ -264,15 +264,10 @@ return } - if (global.MemosApiModern) { - global.MemosApiModern.fetchMemosWithFallback( - info, - '?pageSize=1000', - function (data) { - if (success) success(collectTags(info, extractMemos(data))) - }, - fail - ) + if (global.MemosApiV023) { + global.MemosApiV023.listMemos(info, { pageSize: 1000 }, function (data) { + if (success) success(collectTags(info, extractMemos(data))) + }, fail) } } @@ -369,10 +364,12 @@ } function uploadFile(file, options, success, fail) { - const oldName = String(file && file.name ? file.name : 'upload').split('.') - const fileExt = String(file && file.name ? file.name : '').split('.').pop() + const sourceName = String(file && file.name ? file.name : 'upload') + const lastDot = sourceName.lastIndexOf('.') + const filenameBase = lastDot > 0 ? sourceName.slice(0, lastDot) : sourceName + const fileExt = lastDot > 0 ? sourceName.slice(lastDot) : '' const now = global.dayjs().format('YYYYMMDDHHmmss') - const nextName = oldName[0] + '_' + now + (fileExt ? '.' + fileExt : '') + const nextName = filenameBase + '_' + now + fileExt if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) { global.MemosApiV020V021.uploadResourceBlob( @@ -421,9 +418,9 @@ } requestJson({ - url: info.apiUrl + 'api/v1/' + memoName, + url: info.apiUrl + 'api/v1/' + memoName + '?updateMask=state', type: 'PATCH', - data: JSON.stringify({ state: 'ARCHIVED' }), + data: JSON.stringify({ name: memoName, state: 'ARCHIVED' }), contentType: 'application/json', dataType: 'json', headers: { Authorization: 'Bearer ' + info.apiTokens } diff --git a/firefox/js/compat/memosApi.adapter.js b/firefox/js/compat/memosApi.adapter.js index 333ced2..13d0f95 100644 --- a/firefox/js/compat/memosApi.adapter.js +++ b/firefox/js/compat/memosApi.adapter.js @@ -264,15 +264,10 @@ return } - if (global.MemosApiModern) { - global.MemosApiModern.fetchMemosWithFallback( - info, - '?pageSize=1000', - function (data) { - if (success) success(collectTags(info, extractMemos(data))) - }, - fail - ) + if (global.MemosApiV023) { + global.MemosApiV023.listMemos(info, { pageSize: 1000 }, function (data) { + if (success) success(collectTags(info, extractMemos(data))) + }, fail) } } @@ -369,10 +364,12 @@ } function uploadFile(file, options, success, fail) { - const oldName = String(file && file.name ? file.name : 'upload').split('.') - const fileExt = String(file && file.name ? file.name : '').split('.').pop() + const sourceName = String(file && file.name ? file.name : 'upload') + const lastDot = sourceName.lastIndexOf('.') + const filenameBase = lastDot > 0 ? sourceName.slice(0, lastDot) : sourceName + const fileExt = lastDot > 0 ? sourceName.slice(lastDot) : '' const now = global.dayjs().format('YYYYMMDDHHmmss') - const nextName = oldName[0] + '_' + now + (fileExt ? '.' + fileExt : '') + const nextName = filenameBase + '_' + now + fileExt if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) { global.MemosApiV020V021.uploadResourceBlob( @@ -421,9 +418,9 @@ } requestJson({ - url: info.apiUrl + 'api/v1/' + memoName, + url: info.apiUrl + 'api/v1/' + memoName + '?updateMask=state', type: 'PATCH', - data: JSON.stringify({ state: 'ARCHIVED' }), + data: JSON.stringify({ name: memoName, state: 'ARCHIVED' }), contentType: 'application/json', dataType: 'json', headers: { Authorization: 'Bearer ' + info.apiTokens }