mirror of
https://github.com/Jonnyan404/memos-bber.git
synced 2026-08-22 16:31:40 +09:00
fix: 对齐 Memos 0.29 更新接口
This commit is contained in:
@@ -264,15 +264,10 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global.MemosApiModern) {
|
if (global.MemosApiV023) {
|
||||||
global.MemosApiModern.fetchMemosWithFallback(
|
global.MemosApiV023.listMemos(info, { pageSize: 1000 }, function (data) {
|
||||||
info,
|
if (success) success(collectTags(info, extractMemos(data)))
|
||||||
'?pageSize=1000',
|
}, fail)
|
||||||
function (data) {
|
|
||||||
if (success) success(collectTags(info, extractMemos(data)))
|
|
||||||
},
|
|
||||||
fail
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,10 +364,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uploadFile(file, options, success, fail) {
|
function uploadFile(file, options, success, fail) {
|
||||||
const oldName = String(file && file.name ? file.name : 'upload').split('.')
|
const sourceName = String(file && file.name ? file.name : 'upload')
|
||||||
const fileExt = String(file && file.name ? file.name : '').split('.').pop()
|
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 now = global.dayjs().format('YYYYMMDDHHmmss')
|
||||||
const nextName = oldName[0] + '_' + now + (fileExt ? '.' + fileExt : '')
|
const nextName = filenameBase + '_' + now + fileExt
|
||||||
|
|
||||||
if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) {
|
if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) {
|
||||||
global.MemosApiV020V021.uploadResourceBlob(
|
global.MemosApiV020V021.uploadResourceBlob(
|
||||||
@@ -421,9 +418,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
requestJson({
|
requestJson({
|
||||||
url: info.apiUrl + 'api/v1/' + memoName,
|
url: info.apiUrl + 'api/v1/' + memoName + '?updateMask=state',
|
||||||
type: 'PATCH',
|
type: 'PATCH',
|
||||||
data: JSON.stringify({ state: 'ARCHIVED' }),
|
data: JSON.stringify({ name: memoName, state: 'ARCHIVED' }),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
headers: { Authorization: 'Bearer ' + info.apiTokens }
|
headers: { Authorization: 'Bearer ' + info.apiTokens }
|
||||||
|
|||||||
@@ -264,15 +264,10 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global.MemosApiModern) {
|
if (global.MemosApiV023) {
|
||||||
global.MemosApiModern.fetchMemosWithFallback(
|
global.MemosApiV023.listMemos(info, { pageSize: 1000 }, function (data) {
|
||||||
info,
|
if (success) success(collectTags(info, extractMemos(data)))
|
||||||
'?pageSize=1000',
|
}, fail)
|
||||||
function (data) {
|
|
||||||
if (success) success(collectTags(info, extractMemos(data)))
|
|
||||||
},
|
|
||||||
fail
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,10 +364,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uploadFile(file, options, success, fail) {
|
function uploadFile(file, options, success, fail) {
|
||||||
const oldName = String(file && file.name ? file.name : 'upload').split('.')
|
const sourceName = String(file && file.name ? file.name : 'upload')
|
||||||
const fileExt = String(file && file.name ? file.name : '').split('.').pop()
|
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 now = global.dayjs().format('YYYYMMDDHHmmss')
|
||||||
const nextName = oldName[0] + '_' + now + (fileExt ? '.' + fileExt : '')
|
const nextName = filenameBase + '_' + now + fileExt
|
||||||
|
|
||||||
if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) {
|
if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) {
|
||||||
global.MemosApiV020V021.uploadResourceBlob(
|
global.MemosApiV020V021.uploadResourceBlob(
|
||||||
@@ -421,9 +418,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
requestJson({
|
requestJson({
|
||||||
url: info.apiUrl + 'api/v1/' + memoName,
|
url: info.apiUrl + 'api/v1/' + memoName + '?updateMask=state',
|
||||||
type: 'PATCH',
|
type: 'PATCH',
|
||||||
data: JSON.stringify({ state: 'ARCHIVED' }),
|
data: JSON.stringify({ name: memoName, state: 'ARCHIVED' }),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
headers: { Authorization: 'Bearer ' + info.apiTokens }
|
headers: { Authorization: 'Bearer ' + info.apiTokens }
|
||||||
|
|||||||
@@ -264,15 +264,10 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global.MemosApiModern) {
|
if (global.MemosApiV023) {
|
||||||
global.MemosApiModern.fetchMemosWithFallback(
|
global.MemosApiV023.listMemos(info, { pageSize: 1000 }, function (data) {
|
||||||
info,
|
if (success) success(collectTags(info, extractMemos(data)))
|
||||||
'?pageSize=1000',
|
}, fail)
|
||||||
function (data) {
|
|
||||||
if (success) success(collectTags(info, extractMemos(data)))
|
|
||||||
},
|
|
||||||
fail
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,10 +364,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uploadFile(file, options, success, fail) {
|
function uploadFile(file, options, success, fail) {
|
||||||
const oldName = String(file && file.name ? file.name : 'upload').split('.')
|
const sourceName = String(file && file.name ? file.name : 'upload')
|
||||||
const fileExt = String(file && file.name ? file.name : '').split('.').pop()
|
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 now = global.dayjs().format('YYYYMMDDHHmmss')
|
||||||
const nextName = oldName[0] + '_' + now + (fileExt ? '.' + fileExt : '')
|
const nextName = filenameBase + '_' + now + fileExt
|
||||||
|
|
||||||
if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) {
|
if (flavor === FLAVOR_V020_V021 && global.MemosApiV020V021) {
|
||||||
global.MemosApiV020V021.uploadResourceBlob(
|
global.MemosApiV020V021.uploadResourceBlob(
|
||||||
@@ -421,9 +418,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
requestJson({
|
requestJson({
|
||||||
url: info.apiUrl + 'api/v1/' + memoName,
|
url: info.apiUrl + 'api/v1/' + memoName + '?updateMask=state',
|
||||||
type: 'PATCH',
|
type: 'PATCH',
|
||||||
data: JSON.stringify({ state: 'ARCHIVED' }),
|
data: JSON.stringify({ name: memoName, state: 'ARCHIVED' }),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
headers: { Authorization: 'Bearer ' + info.apiTokens }
|
headers: { Authorization: 'Bearer ' + info.apiTokens }
|
||||||
|
|||||||
Reference in New Issue
Block a user