mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2024-10-24 01:46:35 +02:00
Check google drive file size
This commit is contained in:
parent
30fa15e367
commit
a0727b0ce6
1 changed files with 18 additions and 1 deletions
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
handleError();
|
handleError();
|
||||||
}, 15000);
|
}, 30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelTimeout() {
|
function cancelTimeout() {
|
||||||
|
@ -291,6 +291,23 @@
|
||||||
async function getData() {
|
async function getData() {
|
||||||
console.log('reading remote file now');
|
console.log('reading remote file now');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { result } = await gapi.client.drive.files.get({
|
||||||
|
fileId: $saveId,
|
||||||
|
fields: 'size',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('drive size', result);
|
||||||
|
if (result.size > 50000000) {
|
||||||
|
return {
|
||||||
|
[UPDATE_TIME_KEY]: dayjs('2000-01-01-00:00'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('get file size error', err);
|
||||||
|
handleError();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { result } = await gapi.client.drive.files.get({
|
const { result } = await gapi.client.drive.files.get({
|
||||||
fileId: $saveId,
|
fileId: $saveId,
|
||||||
|
|
Loading…
Reference in a new issue