1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Mobile: Fixed mobile build

This commit is contained in:
Laurent Cozic
2021-01-27 17:42:58 +00:00
parent 35597ce3c2
commit 12187b9da3
24 changed files with 1247 additions and 79 deletions

View File

@ -11,7 +11,6 @@ import RepositoryApi from './RepositoryApi';
import produce from 'immer';
const compareVersions = require('compare-versions');
const uslug = require('uslug');
const md5File = require('md5-file/promise');
const logger = Logger.create('PluginService');
@ -183,7 +182,7 @@ export default class PluginService extends BaseService {
baseDir = rtrimSlashes(baseDir);
const fname = filename(path);
const hash = await md5File(path);
const hash = await shim.fsDriver().md5File(path);
const unpackDir = `${Setting.value('cacheDir')}/${fname}`;
const manifestFilePath = `${unpackDir}/manifest.json`;
@ -194,7 +193,7 @@ export default class PluginService extends BaseService {
await shim.fsDriver().remove(unpackDir);
await shim.fsDriver().mkdir(unpackDir);
await require('tar').extract({
await shim.fsDriver().tarExtract({
strict: true,
portable: true,
file: path,

View File

@ -4,7 +4,7 @@ import Joplin from './Joplin';
/**
* @ignore
*/
const builtinModules = require('builtin-modules');
// const builtinModules = require('builtin-modules');
/**
* @ignore
@ -12,7 +12,7 @@ const builtinModules = require('builtin-modules');
export default class Global {
private joplin_: Joplin;
private requireWhiteList_: string[] = null;
// private requireWhiteList_: string[] = null;
// private consoleWrapper_:any = null;
constructor(implementation: any, plugin: Plugin, store: any) {
@ -40,22 +40,22 @@ export default class Global {
return this.joplin_;
}
private requireWhiteList(): string[] {
if (!this.requireWhiteList_) {
this.requireWhiteList_ = builtinModules.slice();
this.requireWhiteList_.push('fs-extra');
}
return this.requireWhiteList_;
}
// private requireWhiteList(): string[] {
// if (!this.requireWhiteList_) {
// this.requireWhiteList_ = builtinModules.slice();
// this.requireWhiteList_.push('fs-extra');
// }
// return this.requireWhiteList_;
// }
// get console(): any {
// return this.consoleWrapper_;
// }
require(filePath: string): any {
if (!this.requireWhiteList().includes(filePath)) throw new Error(`Path not allowed: ${filePath}`);
return require(filePath);
}
// require(filePath: string): any {
// if (!this.requireWhiteList().includes(filePath)) throw new Error(`Path not allowed: ${filePath}`);
// return require(filePath);
// }
// To get webpack to work with Node module we need to set the parameter `target: "node"`, however
// when setting this, the code generated by webpack will try to access the `process` global variable,