fix #94 移动端加载失败

This commit is contained in:
wanxuping 2024-12-26 13:47:01 +08:00
parent 8f2c5f2117
commit eeedf23e7c
2 changed files with 8 additions and 3 deletions

@ -36,7 +36,8 @@ export default class Logger {
console.error(e); console.error(e);
}else { }else {
try { try {
console.log(`OB-Douban:${moment(new Date()).format('YYYY-MM-DD HH:mm:SS')}:${typeof e == 'string' ? e : JSON.stringify(e)}`); let showMessage = typeof e == 'string' ? e : e.toString();
console.log(`OB-Douban:${moment(new Date()).format('YYYY-MM-DD HH:mm:SS')}: ${showMessage}`);
}catch (e) { }catch (e) {
console.log(`OB-Douban:${moment(new Date()).format('YYYY-MM-DD HH:mm:SS')}:` + e.toString()); console.log(`OB-Douban:${moment(new Date()).format('YYYY-MM-DD HH:mm:SS')}:` + e.toString());
} }

@ -1,3 +1,5 @@
import {Platform} from "obsidian";
export class HttpResponse { export class HttpResponse {
private readonly _status:number; private readonly _status:number;
private readonly _headers:Record<string, string>; private readonly _headers:Record<string, string>;
@ -32,9 +34,11 @@ export class HttpResponse {
} }
get textArrayBuffer():ArrayBuffer { get textArrayBuffer():ArrayBuffer {
if (Platform.isDesktopApp) {
if (this.text instanceof Buffer) { if (this.text instanceof Buffer) {
return this.text as Buffer; return this.text as Buffer;
} }
}
if (this.text instanceof ArrayBuffer) { if (this.text instanceof ArrayBuffer) {
return this.text as ArrayBuffer; return this.text as ArrayBuffer;
} }