mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
feat: consistent sync function (requestUrl) for desktop and mobile
This commit is contained in:
@@ -50,8 +50,10 @@ export async function uploadCommandNext(
|
||||
const {response} = res;
|
||||
if (response.status === 200) {
|
||||
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
|
||||
console.log(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`);
|
||||
} else {
|
||||
new Notice(`${i18nConfig["sync-fail"]} ${basename}`, 5000);
|
||||
console.log(`${i18nConfig["sync-fail"]} ${basename}`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -88,8 +90,10 @@ export async function uploadCommandGeneral(
|
||||
const {response} = res;
|
||||
if (response.status === 200) {
|
||||
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
|
||||
console.log(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`);
|
||||
} else {
|
||||
new Notice(`${i18nConfig["sync-fail"]} ${basename}`, 5000);
|
||||
console.log(`${i18nConfig["sync-fail"]} ${basename}`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -124,10 +128,13 @@ export async function uploadCommandCustom(
|
||||
const res = await upload.syncMarkdownToNotionCustom(cover, customValues, markDownData, nowFile, this.app);
|
||||
|
||||
const {response} = res;
|
||||
|
||||
if (response.status === 200) {
|
||||
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
|
||||
console.log(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`);
|
||||
} else {
|
||||
new Notice(`${i18nConfig["sync-fail"]} ${basename}`, 5000);
|
||||
console.log(`${i18nConfig["sync-fail"]} ${basename}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {App, Notice, TFile, Platform, requestUrl} from "obsidian";
|
||||
import {App, Notice, TFile, requestUrl} from "obsidian";
|
||||
import {markdownToBlocks} from "@jxpeng98/martian";
|
||||
import * as yamlFrontMatter from "yaml-front-matter";
|
||||
import MyPlugin from "src/main";
|
||||
import {DatabaseDetails, PluginSettings} from "../../ui/settingTabs";
|
||||
import {UploadBaseGeneral} from "./BaseUpload2NotionGeneral";
|
||||
import {updateYamlInfo} from "../updateYaml";
|
||||
import fetch from 'node-fetch';
|
||||
import {i18nConfig} from "../../lang/I18n";
|
||||
|
||||
interface CreatePageResponse {
|
||||
@@ -142,81 +141,67 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
||||
}
|
||||
|
||||
console.log(bodyString)
|
||||
console.log(Platform.isDesktopApp)
|
||||
|
||||
let response: any;
|
||||
let data: any;
|
||||
|
||||
if (Platform.isMobileApp) {
|
||||
if(childArrLength > 100) {
|
||||
new Notice(i18nConfig["reach-mobile-limit"], 5000);
|
||||
} else {
|
||||
response = await requestUrl({
|
||||
url: `https://api.notion.com/v1/pages`,
|
||||
method: "POST",
|
||||
response = await requestUrl({
|
||||
url: `https://api.notion.com/v1/pages`,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// 'User-Agent': 'obsidian.md',
|
||||
Authorization:
|
||||
"Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
throw: false
|
||||
});
|
||||
|
||||
data = await response.json;
|
||||
|
||||
// console.log(data)
|
||||
// console.log(response.status)
|
||||
|
||||
if (response.status !== 200) {
|
||||
new Notice(`Error ${data.status}: ${data.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${data.message}`);
|
||||
} else {
|
||||
console.log(`Page created: ${data.url}`);
|
||||
console.log(`Page ID: ${data.id}`);
|
||||
}
|
||||
//
|
||||
// upload the rest of the blocks
|
||||
if (pushCount > 0) {
|
||||
for (let i = 0; i < pushCount; i++) {
|
||||
const extraBlocks = {
|
||||
children: extraArr[i],
|
||||
};
|
||||
|
||||
console.log(extraBlocks)
|
||||
|
||||
const extraResponse = await requestUrl({
|
||||
url: `https://api.notion.com/v1/blocks/${data.id}/children`,
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// 'User-Agent': 'obsidian.md',
|
||||
Authorization:
|
||||
"Bearer " + notionAPI,
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
body: JSON.stringify(extraBlocks),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isDesktopApp) {
|
||||
response = await fetch("https://api.notion.com/v1/pages", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
});
|
||||
const extraData: any = await extraResponse.json;
|
||||
|
||||
data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
new Notice(`Error ${data.status}: ${data.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${data.message}`);
|
||||
} else {
|
||||
console.log(`Page created: ${data.url}`);
|
||||
console.log(`Page ID: ${data.id}`);
|
||||
}
|
||||
|
||||
// upload the rest of the blocks
|
||||
if (pushCount > 0) {
|
||||
for (let i = 0; i < pushCount; i++) {
|
||||
const extraBlocks = {
|
||||
children: extraArr[i],
|
||||
};
|
||||
|
||||
console.log(extraBlocks)
|
||||
|
||||
const extraResponse = await fetch(`https://api.notion.com/v1/blocks/${data.id}/children`, {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(extraBlocks),
|
||||
});
|
||||
|
||||
const extraData: any = await extraResponse.json();
|
||||
|
||||
if (!extraResponse.ok) {
|
||||
new Notice(`Error ${extraData.status}: ${extraData.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${extraData.message}`);
|
||||
} else {
|
||||
console.log(`${i18nConfig["ExtraBlockUploaded"]} to page: ${data.id}`);
|
||||
if (i === pushCount - 1) {
|
||||
console.log(`${i18nConfig["BlockUploaded"]} to page: ${data.id}`);
|
||||
new Notice(`${i18nConfig["BlockUploaded"]} page: ${data.id}`, 5000);
|
||||
}
|
||||
if (extraResponse.status !== 200) {
|
||||
new Notice(`Error ${extraData.status}: ${extraData.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${extraData.message}`);
|
||||
} else {
|
||||
console.log(`${i18nConfig["ExtraBlockUploaded"]} to page: ${data.id}`);
|
||||
if (i === pushCount - 1) {
|
||||
console.log(`${i18nConfig["BlockUploaded"]} to page: ${data.id}`);
|
||||
new Notice(`${i18nConfig["BlockUploaded"]} page: ${data.id}`, 5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,30 +251,17 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
||||
|
||||
let {response, data} = res;
|
||||
|
||||
if (Platform.isDesktopApp) {
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
data,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails
|
||||
);
|
||||
}
|
||||
}
|
||||
// console.log(response)
|
||||
|
||||
if (Platform.isMobileApp) {
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
response,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails,
|
||||
);
|
||||
}
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
data,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails,
|
||||
);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import {UploadBaseNext} from "./BaseUpload2NotionNext";
|
||||
import {App, Notice, TFile, Platform, requestUrl} from "obsidian";
|
||||
import {App, Notice, TFile, requestUrl} from "obsidian";
|
||||
import {markdownToBlocks} from "@jxpeng98/martian";
|
||||
import * as yamlFrontMatter from "yaml-front-matter";
|
||||
import MyPlugin from "src/main";
|
||||
import {DatabaseDetails, PluginSettings} from "../../ui/settingTabs";
|
||||
import {updateYamlInfo} from "../updateYaml";
|
||||
import {LIMITS, paragraph} from "@jxpeng98/martian/src/notion";
|
||||
import fetch from 'node-fetch';
|
||||
import {i18nConfig} from "../../lang/I18n";
|
||||
|
||||
interface CreatePageResponse {
|
||||
@@ -247,76 +246,63 @@ export class Upload2NotionNext extends UploadBaseNext {
|
||||
let response: any;
|
||||
let data: any;
|
||||
|
||||
if (Platform.isMobileApp) {
|
||||
if(childArrLength > 100) {
|
||||
new Notice(i18nConfig["reach-mobile-limit"], 5000);
|
||||
} else {
|
||||
response = await requestUrl({
|
||||
url: `https://api.notion.com/v1/pages`,
|
||||
method: "POST",
|
||||
response = await requestUrl({
|
||||
url: `https://api.notion.com/v1/pages`,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// 'User-Agent': 'obsidian.md',
|
||||
Authorization:
|
||||
"Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
throw: false
|
||||
});
|
||||
|
||||
data = await response.json;
|
||||
|
||||
// console.log(data)
|
||||
// console.log(response.status)
|
||||
|
||||
if (response.status !== 200) {
|
||||
new Notice(`Error ${data.status}: ${data.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${data.message}`);
|
||||
} else {
|
||||
console.log(`Page created: ${data.url}`);
|
||||
console.log(`Page ID: ${data.id}`);
|
||||
}
|
||||
//
|
||||
// upload the rest of the blocks
|
||||
if (pushCount > 0) {
|
||||
for (let i = 0; i < pushCount; i++) {
|
||||
const extraBlocks = {
|
||||
children: extraArr[i],
|
||||
};
|
||||
|
||||
console.log(extraBlocks)
|
||||
|
||||
const extraResponse = await requestUrl({
|
||||
url: `https://api.notion.com/v1/blocks/${data.id}/children`,
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// 'User-Agent': 'obsidian.md',
|
||||
Authorization:
|
||||
"Bearer " + notionAPI,
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
body: JSON.stringify(extraBlocks),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isDesktopApp) {
|
||||
response = await fetch("https://api.notion.com/v1/pages", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
});
|
||||
const extraData: any = await extraResponse.json;
|
||||
|
||||
data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
new Notice(`Error ${data.status}: ${data.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${data.message}`);
|
||||
} else {
|
||||
console.log(`Page created: ${data.url}`);
|
||||
console.log(`Page ID: ${data.id}`);
|
||||
}
|
||||
|
||||
// upload the rest of the blocks
|
||||
if (pushCount > 0) {
|
||||
for (let i = 0; i < pushCount; i++) {
|
||||
const extraBlocks = {
|
||||
children: extraArr[i],
|
||||
};
|
||||
|
||||
console.log(extraBlocks)
|
||||
|
||||
const extraResponse = await fetch(`https://api.notion.com/v1/blocks/${data.id}/children`, {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(extraBlocks),
|
||||
});
|
||||
|
||||
const extraData: any = await extraResponse.json();
|
||||
|
||||
if (!extraResponse.ok) {
|
||||
new Notice(`Error ${extraData.status}: ${extraData.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${extraData.message}`);
|
||||
} else {
|
||||
console.log(`${i18nConfig["ExtraBlockUploaded"]} to page: ${data.id}`);
|
||||
if (i === pushCount - 1) {
|
||||
console.log(`${i18nConfig["BlockUploaded"]} to page: ${data.id}`);
|
||||
new Notice(`${i18nConfig["BlockUploaded"]} page: ${data.id}`, 5000);
|
||||
}
|
||||
if (extraResponse.status !== 200) {
|
||||
new Notice(`Error ${extraData.status}: ${extraData.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${extraData.message}`);
|
||||
} else {
|
||||
console.log(`${i18nConfig["ExtraBlockUploaded"]} to page: ${data.id}`);
|
||||
if (i === pushCount - 1) {
|
||||
console.log(`${i18nConfig["BlockUploaded"]} to page: ${data.id}`);
|
||||
new Notice(`${i18nConfig["BlockUploaded"]} page: ${data.id}`, 5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,30 +402,17 @@ export class Upload2NotionNext extends UploadBaseNext {
|
||||
|
||||
let {response, data} = res;
|
||||
|
||||
if (Platform.isDesktopApp) {
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
data,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails
|
||||
);
|
||||
}
|
||||
}
|
||||
// console.log(response)
|
||||
|
||||
if (Platform.isMobileApp) {
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
response,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails,
|
||||
);
|
||||
}
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
data,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails,
|
||||
);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {App, Notice, Platform, TFile, requestUrl} from "obsidian";
|
||||
import {App, Notice, TFile, requestUrl} from "obsidian";
|
||||
import {markdownToBlocks} from "@jxpeng98/martian";
|
||||
import * as yamlFrontMatter from "yaml-front-matter";
|
||||
import MyPlugin from "src/main";
|
||||
import {DatabaseDetails, PluginSettings} from "../../ui/settingTabs";
|
||||
import {updateYamlInfo} from "../updateYaml";
|
||||
import {UploadBaseCustom} from "./BaseUpload2NotionCustom";
|
||||
import fetch from 'node-fetch';
|
||||
import {i18nConfig} from "../../lang/I18n";
|
||||
|
||||
|
||||
@@ -60,15 +59,15 @@ export class Upload2NotionCustom extends UploadBaseCustom {
|
||||
|
||||
// remove the annotations from the childArr if type is code block
|
||||
childArr.forEach((block: any) => {
|
||||
if (block.type === "code") {
|
||||
block.code.rich_text.forEach((item: any) => {
|
||||
if (item.type === "text" && item.annotations) {
|
||||
delete item.annotations;
|
||||
if (block.type === "code") {
|
||||
block.code.rich_text.forEach((item: any) => {
|
||||
if (item.type === "text" && item.annotations) {
|
||||
delete item.annotations;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// check the length of the childArr and split it into chunks of 100
|
||||
@@ -114,81 +113,67 @@ export class Upload2NotionCustom extends UploadBaseCustom {
|
||||
}
|
||||
|
||||
console.log(bodyString)
|
||||
console.log(Platform.isDesktopApp)
|
||||
|
||||
let response: any;
|
||||
let data: any;
|
||||
|
||||
if (Platform.isMobileApp) {
|
||||
if(childArrLength > 100) {
|
||||
new Notice(i18nConfig["reach-mobile-limit"], 5000);
|
||||
} else {
|
||||
response = await requestUrl({
|
||||
url: `https://api.notion.com/v1/pages`,
|
||||
method: "POST",
|
||||
response = await requestUrl({
|
||||
url: `https://api.notion.com/v1/pages`,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// 'User-Agent': 'obsidian.md',
|
||||
Authorization:
|
||||
"Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
throw: false
|
||||
});
|
||||
|
||||
data = await response.json;
|
||||
|
||||
// console.log(data)
|
||||
// console.log(response.status)
|
||||
|
||||
if (response.status !== 200) {
|
||||
new Notice(`Error ${data.status}: ${data.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${data.message}`);
|
||||
} else {
|
||||
console.log(`Page created: ${data.url}`);
|
||||
console.log(`Page ID: ${data.id}`);
|
||||
}
|
||||
//
|
||||
// upload the rest of the blocks
|
||||
if (pushCount > 0) {
|
||||
for (let i = 0; i < pushCount; i++) {
|
||||
const extraBlocks = {
|
||||
children: extraArr[i],
|
||||
};
|
||||
|
||||
console.log(extraBlocks)
|
||||
|
||||
const extraResponse = await requestUrl({
|
||||
url: `https://api.notion.com/v1/blocks/${data.id}/children`,
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// 'User-Agent': 'obsidian.md',
|
||||
Authorization:
|
||||
"Bearer " + notionAPI,
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
body: JSON.stringify(extraBlocks),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isDesktopApp) {
|
||||
response = await fetch("https://api.notion.com/v1/pages", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(bodyString),
|
||||
});
|
||||
const extraData: any = await extraResponse.json;
|
||||
|
||||
data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
new Notice(`Error ${data.status}: ${data.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${data.message}`);
|
||||
} else {
|
||||
console.log(`Page created: ${data.url}`);
|
||||
console.log(`Page ID: ${data.id}`);
|
||||
}
|
||||
|
||||
// upload the rest of the blocks
|
||||
if (pushCount > 0) {
|
||||
for (let i = 0; i < pushCount; i++) {
|
||||
const extraBlocks = {
|
||||
children: extraArr[i],
|
||||
};
|
||||
|
||||
console.log(extraBlocks)
|
||||
|
||||
const extraResponse = await fetch(`https://api.notion.com/v1/blocks/${data.id}/children`, {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + notionAPI,
|
||||
"Notion-Version": "2022-06-28",
|
||||
},
|
||||
body: JSON.stringify(extraBlocks),
|
||||
});
|
||||
|
||||
const extraData: any = await extraResponse.json();
|
||||
|
||||
if (!extraResponse.ok) {
|
||||
new Notice(`Error ${extraData.status}: ${extraData.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${extraData.message}`);
|
||||
} else {
|
||||
console.log(`${i18nConfig["ExtraBlockUploaded"]} to page: ${data.id}`);
|
||||
if (i === pushCount - 1) {
|
||||
console.log(`${i18nConfig["BlockUploaded"]} to page: ${data.id}`);
|
||||
new Notice(`${i18nConfig["BlockUploaded"]} page: ${data.id}`, 5000);
|
||||
}
|
||||
if (extraResponse.status !== 200) {
|
||||
new Notice(`Error ${extraData.status}: ${extraData.code} \n ${i18nConfig["CheckConsole"]}`, 5000);
|
||||
console.log(`Error message: \n ${extraData.message}`);
|
||||
} else {
|
||||
console.log(`${i18nConfig["ExtraBlockUploaded"]} to page: ${data.id}`);
|
||||
if (i === pushCount - 1) {
|
||||
console.log(`${i18nConfig["BlockUploaded"]} to page: ${data.id}`);
|
||||
new Notice(`${i18nConfig["BlockUploaded"]} page: ${data.id}`, 5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,30 +223,15 @@ export class Upload2NotionCustom extends UploadBaseCustom {
|
||||
|
||||
// console.log(response)
|
||||
|
||||
if (Platform.isDesktopApp) {
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
data,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isMobileApp) {
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
response,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails,
|
||||
);
|
||||
}
|
||||
if (response && response.status === 200) {
|
||||
await updateYamlInfo(
|
||||
markdown,
|
||||
nowFile,
|
||||
data,
|
||||
app,
|
||||
this.plugin,
|
||||
this.dbDetails,
|
||||
);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user