fix android can not load plugins

This commit is contained in:
wanxp 2024-03-14 13:10:17 +08:00
parent ba5e6a8ee2
commit 5c3edc909e
3 changed files with 8 additions and 6 deletions

@ -29,7 +29,7 @@
"@notable/html2markdown": "^1.1.3", "@notable/html2markdown": "^1.1.3",
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
"cheerio": "^1.0.0-rc.11", "cheerio": "^1.0.0-rc.11",
"follow-redirects": "^1.15.3", "schema-dts": "^1.1.0",
"schema-dts": "^1.1.0" "simple-get": "^4.0.1"
} }
} }

@ -164,11 +164,13 @@ export default class DoubanPlugin extends Plugin {
} }
async onload() { async onload() {
console.log("----douban-plugins-load------")
await this.loadSettings(); await this.loadSettings();
if (this.settings.statusBar) { if (this.settings.statusBar) {
this.doubanStatusBar = this.addStatusBarItem(); this.doubanStatusBar = this.addStatusBarItem();
} }
this.addCommand({ this.addCommand({
id: "searcher-douban-import-and-create-file", id: "searcher-douban-import-and-create-file",
name: i18nHelper.getMessage("110101"), name: i18nHelper.getMessage("110101"),

@ -5,7 +5,7 @@ import { request, RequestUrlParam } from "obsidian";
import DoubanHumanCheckModel from "../douban/component/DoubanHumanCheckModel"; import DoubanHumanCheckModel from "../douban/component/DoubanHumanCheckModel";
import {LoginUtil} from "./LoginUtil"; import {LoginUtil} from "./LoginUtil";
const {https} = require("follow-redirects"); const get = require('simple-get')
export default class HttpUtil { export default class HttpUtil {
@ -26,7 +26,7 @@ export default class HttpUtil {
} }
settingsManager.debug(`Obsidian-Douban:从网络获取网页开始:\nurl:${url}\nheaders:${JSON.stringify(headers)}`); settingsManager.debug(`Obsidian-Douban:从网络获取网页开始:\nurl:${url}\nheaders:${JSON.stringify(headers)}`);
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
https.get(url, { ...options }, function (response: any) { get(url, { ...options }, function (err:any, response: any) {
let chunks: any = [], let chunks: any = [],
size = 0; size = 0;
if (response.status == 403) { if (response.status == 403) {
@ -66,7 +66,7 @@ export default class HttpUtil {
} }
settingsManager.debug(`Obsidian-Douban:从网络获取json开始:\nurl:${url}\nheaders:${JSON.stringify(headers)}`); settingsManager.debug(`Obsidian-Douban:从网络获取json开始:\nurl:${url}\nheaders:${JSON.stringify(headers)}`);
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
https.get(url, { ...options }, function (response: any) { get(url, { ...options }, function (err:any, response: any) {
const chunks: any = []; const chunks: any = [];
let size = 0; let size = 0;
if (response.status == 403) { if (response.status == 403) {
@ -106,7 +106,7 @@ export default class HttpUtil {
settingsManager.debug(`Obsidian-Douban:从网络获取文件开始:\n${url}`); settingsManager.debug(`Obsidian-Douban:从网络获取文件开始:\n${url}`);
} }
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
https.get(url, { ...options }, function (response: any) { get(url, { ...options }, function (err:any, response: any) {
let chunks: any = [], let chunks: any = [],
size = 0; size = 0;
if (response.status == 403) { if (response.status == 403) {