make work

This commit is contained in:
peter
2019-08-27 19:25:17 +02:00
parent 19e011d518
commit fb86ed1978
7 changed files with 2740 additions and 14 deletions
-5
View File
@@ -3964,11 +3964,6 @@
"requires": { "requires": {
"ms": "^2.1.1" "ms": "^2.1.1"
} }
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
} }
} }
}, },
+1
View File
@@ -39,6 +39,7 @@
"rimraf": "^3.0.0", "rimraf": "^3.0.0",
"simple-git": "^1.124.0", "simple-git": "^1.124.0",
"spawn-sync": "^2.0.0", "spawn-sync": "^2.0.0",
"sqlite3": "^4.1.0",
"trash": "^6.0.0", "trash": "^6.0.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
}, },
+1 -5
View File
@@ -3,8 +3,7 @@
import * as Logger from 'log4js' import * as Logger from 'log4js'
import * as Knex from 'knex' import * as Knex from 'knex'
import { FrontblockApiClient, FrontblockApiConf } from 'frontblock'; import { FrontblockApiClient, FrontblockApiConf } from 'frontblock';
import { socketioRPC, rpcHooker, ExtendedRpcInfo } from 'frontblock-generic/RPC'; import { AdminBase } from 'frontblock-generic/Admin';
import { ApiClientBase, AdminBase } from 'frontblock-generic/Admin';
import express = require('express'); import express = require('express');
import http = require('http'); import http = require('http');
import bsock = require('bsock'); import bsock = require('bsock');
@@ -173,9 +172,6 @@ export class FrontblockAdmin extends AdminBase<AdminConf>{
} }
} }
new FrontblockAdmin()
process.on( 'SIGINT', function() { process.on( 'SIGINT', function() {
logger.info( "Gracefully shutting down from SIGINT (Ctrl-C)" ); logger.info( "Gracefully shutting down from SIGINT (Ctrl-C)" );
// some other closing procedures go here // some other closing procedures go here
+25
View File
@@ -0,0 +1,25 @@
import * as Logger from 'log4js'
var exec = require('child-process-promise').exec;
Logger.configure({
appenders:
{
"admin": { type: 'stdout' },
//app: { type: 'file', filename: 'application.log' }
},
categories:
{
default: { appenders: [ 'admin' ], level: 'debug' }
}
})
const logger = Logger.getLogger("admin")
logger.info("Checking npm dependencies...")
exec("npm i --prefix ./plugins knex@0.19.2 sqlite3@4.1.0").then(process => {
logger.debug(process.stdout)
const admin = require("./FrontblockAdmin").FrontblockAdmin
new admin()
})
+12 -2
View File
@@ -41,7 +41,7 @@ export class UpdateManager extends Plugin{
exportRPCs(): socketioRPC[] { exportRPCs(): socketioRPC[] {
return [{ return [{
name: 'installPlugin', name: 'installPlugin',
func: async (name:string, force = false) => { }, func: async (name:string, force = false) => {return await this.installPlugin(name, force)},
type: 'call', type: 'call',
visibility: 'private' visibility: 'private'
},{ },{
@@ -86,19 +86,29 @@ export class UpdateManager extends Plugin{
logger.info(res.stdout) logger.info(res.stdout)
*/ */
/*
const extensions = [ const extensions = [
new NPMExtension("sqlite3", "./plugins", "4.1.0"), new NPMExtension("sqlite3", "./plugins", "4.1.0"),
new NPMExtension("frontblock", "./plugins", "latest") new NPMExtension("frontblock", "./plugins", "latest")
] ]
*/
const extensions:NPMExtension[] = []
await Promise.all(extensions.map(e => e.install())) await Promise.all(extensions.map(e => e.install()))
const status = await Promise.all(extensions.map(e => e.status())) const status = await Promise.all(extensions.map(e => e.status()))
console.log(status) console.log(status)
} }
async installPlugin(name: string, force:boolean = false):Promise<RepoFolderStatus>{
logger.warn("Cloning fb-dist/"+name+".git into ./plugins/"+name+" ..."+(force?" USING FORCE!":""))
this.pluginUpdaters[name] = new GitUpdater("./plugins/"+name)
const status = await this.pluginUpdaters[name].cloneRepo("https://gitea.frontblock.me/fb-dist/"+name.toLowerCase()+".git", force)
return status
}
async updateAdmin(force:boolean = false){ async updateAdmin(force:boolean = false){
this.adminUpdater = new GitUpdater("./dist") this.adminUpdater = new GitUpdater("./dist")
let status = await this.adminUpdater.getStatus() let status = await this.adminUpdater.getStatus()
+16 -2
View File
@@ -19,15 +19,29 @@ module.exports = [{
__dirname: false, __dirname: false,
Buffer: true, Buffer: true,
}, },
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
{ test: /\.ts?$/, loader: "ts-loader" }
]
},
externals:{ externals:{
sqlite3: 'sqlite3', knex: "../plugins/node_modules/knex"
}, },
optimization: { optimization: {
minimize: false minimize: false
}, },
entry: path.resolve(__dirname, '../../lib/FrontblockAdmin.js'), entry: path.resolve(__dirname, 'Main.ts'),
output: { output: {
path: path.resolve(__dirname, '../../dist'), path: path.resolve(__dirname, '../../dist'),
filename: 'FrontblockAdmin.js', filename: 'FrontblockAdmin.js',
libraryTarget: 'commonjs',
} }
}] }]
File diff suppressed because it is too large Load Diff