mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-04 08:38:41 +08:00
fix #94 移动端加载失败
This commit is contained in:
parent
3ff2b8f4db
commit
8437aee2e1
@ -38,9 +38,10 @@
|
|||||||
- ☑️ 导入电影、电视剧、书籍、音乐、游戏、日记
|
- ☑️ 导入电影、电视剧、书籍、音乐、游戏、日记
|
||||||
- ☑️ 同步个人听过/看过的电影、电视剧、书籍、音乐
|
- ☑️ 同步个人听过/看过的电影、电视剧、书籍、音乐
|
||||||
- ☑️ 导入个人的评论,评论时间,阅读状态,个人评分
|
- ☑️ 导入个人的评论,评论时间,阅读状态,个人评分
|
||||||
- ☑️ 支持保存封面至本地
|
- ☑️ 支持保存封面至本地/图床
|
||||||
- ☑️ 支持保存封面至图床
|
- ⬜ 支持图床自定义
|
||||||
- ☑️ 支持自定义参数
|
- ☑️ 支持自定义参数
|
||||||
|
- ☑️ 支持移动端导入
|
||||||
|
|
||||||
## 效果
|
## 效果
|
||||||
1. 结合Timeline插件 __构建个人观影时间线__,请参照[结合timeline插件实现时间线效果](./doc/Obsidian-Douban-TimeLine.md)
|
1. 结合Timeline插件 __构建个人观影时间线__,请参照[结合timeline插件实现时间线效果](./doc/Obsidian-Douban-TimeLine.md)
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-douban-plugin",
|
"name": "obsidian-douban-plugin",
|
||||||
"version": "2.0.0",
|
"version": "2.0.8",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "obsidian-douban-plugin",
|
"name": "obsidian-douban-plugin",
|
||||||
"version": "2.0.0",
|
"version": "2.0.8",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@notable/html2markdown": "^1.1.3",
|
"@notable/html2markdown": "^1.1.3",
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import DoubanPlugin from "../../../main";
|
import DoubanPlugin from "../../../main";
|
||||||
import DoubanSubject, {DoubanParameterName} from '../model/DoubanSubject';
|
import DoubanSubject, {DoubanParameterName} from '../model/DoubanSubject';
|
||||||
import DoubanSubjectLoadHandler from "./DoubanSubjectLoadHandler";
|
import DoubanSubjectLoadHandler from "./DoubanSubjectLoadHandler";
|
||||||
import {moment, TFile} from "obsidian";
|
import {moment, Platform, TFile} from "obsidian";
|
||||||
import {i18nHelper} from 'src/org/wanxp/lang/helper';
|
import {i18nHelper} from 'src/org/wanxp/lang/helper';
|
||||||
import {log} from "src/org/wanxp/utils/Logutil";
|
import {log} from "src/org/wanxp/utils/Logutil";
|
||||||
import {CheerioAPI, load} from "cheerio";
|
import {CheerioAPI, load} from "cheerio";
|
||||||
@ -535,7 +535,8 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async handleImage(image: string, folder: string, filename: string, context: HandleContext, showError: boolean, headers?: any) {
|
private async handleImage(image: string, folder: string, filename: string, context: HandleContext, showError: boolean, headers?: any) {
|
||||||
if (context.settings.pictureBedFlag) {
|
//只有在桌面版且开启了图片上传才会使用PicGo,并且开启图床功能
|
||||||
|
if (context.settings.pictureBedFlag && Platform.isDesktopApp) {
|
||||||
//临时限定只支持PicGo
|
//临时限定只支持PicGo
|
||||||
const checked = await context.netFileHandler.downloadDBUploadPicGoByClipboardBefore(context);
|
const checked = await context.netFileHandler.downloadDBUploadPicGoByClipboardBefore(context);
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
const { clipboard, nativeImage } = require('electron');
|
|
||||||
|
|
||||||
export class ClipboardUtil {
|
export class ClipboardUtil {
|
||||||
|
|
||||||
public static async writeImage(data:ArrayBuffer, options: ClipboardOptions = defaultClipboardOptions) {
|
public static async writeImage(data:ArrayBuffer, options: ClipboardOptions = defaultClipboardOptions) {
|
||||||
|
const { clipboard, nativeImage } = require('electron');
|
||||||
|
|
||||||
await clipboard.writeImage(nativeImage.createFromBuffer(data));
|
await clipboard.writeImage(nativeImage.createFromBuffer(data));
|
||||||
console.log(`Copied to clipboard as HTML`);
|
console.log(`Copied to clipboard as HTML`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import {requestUrl, RequestUrlParam, RequestUrlResponse} from "obsidian";
|
|||||||
import {log} from "../Logutil";
|
import {log} from "../Logutil";
|
||||||
import {i18nHelper} from "../../lang/helper";
|
import {i18nHelper} from "../../lang/helper";
|
||||||
import {DoubanHttpUtil} from "../DoubanHttpUtil";
|
import {DoubanHttpUtil} from "../DoubanHttpUtil";
|
||||||
|
import {request} from "https";
|
||||||
|
|
||||||
export default class MobileHttpUtil {
|
export default class MobileHttpUtil {
|
||||||
/**
|
/**
|
||||||
@ -15,11 +16,14 @@ export default class MobileHttpUtil {
|
|||||||
return this.httpRequestGetInner(url, headers, 0, settingsManager);
|
return this.httpRequestGetInner(url, headers, 0, settingsManager);
|
||||||
}
|
}
|
||||||
private static async httpRequestGetInner(url: string, headers: any, times:number, settingsManager?: SettingsManager): Promise<RequestUrlResponse> {
|
private static async httpRequestGetInner(url: string, headers: any, times:number, settingsManager?: SettingsManager): Promise<RequestUrlResponse> {
|
||||||
|
|
||||||
|
const {Cookie, ...headersInner} = headers;
|
||||||
|
|
||||||
let requestUrlParam: RequestUrlParam = {
|
let requestUrlParam: RequestUrlParam = {
|
||||||
url: url,
|
url: url,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: { ...headers},
|
headers: {'Cookie': Cookie},
|
||||||
throw: true
|
throw: true,
|
||||||
};
|
};
|
||||||
return await requestUrl(requestUrlParam)
|
return await requestUrl(requestUrlParam)
|
||||||
// .then(res => res.text)
|
// .then(res => res.text)
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"inlineSourceMap": true,
|
"inlineSourceMap": true,
|
||||||
"inlineSources": true,
|
"inlineSources": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"target": "ES6",
|
"target": "ES2018",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user