Compare commits

...

7 Commits

Author SHA1 Message Date
2185b1a2f8 v0.6.5 2020-05-12 14:35:26 +08:00
c14e20e269 feat: optimize framework
Signed-off-by: MiaoWoo <admin@yumc.pw>
2020-05-12 14:22:31 +08:00
45a1c43dd8 feat: complate deploy access check
Signed-off-by: MiaoWoo <admin@yumc.pw>
2020-05-12 00:07:05 +08:00
9226e1ab4f feat: ignore if trace.fileName is empty
Signed-off-by: MiaoWoo <admin@yumc.pw>
2020-05-11 22:13:31 +08:00
287585d8f5 feat: add node shim
Signed-off-by: MiaoWoo <admin@yumc.pw>
2020-05-11 22:13:03 +08:00
b323d16123 v0.6.4 2020-05-11 17:52:13 +08:00
85240608a1 feat: add npmignore
Signed-off-by: MiaoWoo <admin@yumc.pw>
2020-05-11 17:46:57 +08:00
23 changed files with 131 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
{ {
"version": "0.6.3", "version": "0.6.5",
"useWorkspaces": true, "useWorkspaces": true,
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/api", "name": "@ccms/api",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript api package", "description": "MiaoScript api package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -20,7 +20,7 @@
}, },
"dependencies": { "dependencies": {
"@ccms/container": "^0.6.0", "@ccms/container": "^0.6.0",
"@ccms/ployfill": "^0.6.3", "@ccms/ployfill": "^0.6.5",
"base64-js": "^1.3.1", "base64-js": "^1.3.1",
"source-map-builder": "^0.0.7" "source-map-builder": "^0.0.7"
}, },

View File

@@ -136,7 +136,7 @@ export class MiaoScriptConsole implements Console {
stack = Arrays.asList(stack) stack = Arrays.asList(stack)
} }
stack.forEach(trace => { stack.forEach(trace => {
if (trace.fileName.startsWith('jar:file:')) { return } if (!trace.fileName || trace.fileName.startsWith('jar:file:')) { return }
if (trace.className.startsWith('<')) { if (trace.className.startsWith('<')) {
let { fileName, lineNumber } = this.readSourceMap(trace.fileName, trace.lineNumber) let { fileName, lineNumber } = this.readSourceMap(trace.fileName, trace.lineNumber)
if (fileName.startsWith(root)) { fileName = fileName.split(root)[1] } if (fileName.startsWith(root)) { fileName = fileName.split(root)[1] }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/bukkit", "name": "@ccms/bukkit",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript bukkit package", "description": "MiaoScript bukkit package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,8 +24,8 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/api": "^0.6.3", "@ccms/api": "^0.6.5",
"@ccms/common": "^0.6.3", "@ccms/common": "^0.6.4",
"@ccms/container": "^0.6.0" "@ccms/container": "^0.6.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/bungee", "name": "@ccms/bungee",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript bungee package", "description": "MiaoScript bungee package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,8 +24,8 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/api": "^0.6.3", "@ccms/api": "^0.6.5",
"@ccms/common": "^0.6.3", "@ccms/common": "^0.6.4",
"@ccms/container": "^0.6.0" "@ccms/container": "^0.6.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/common", "name": "@ccms/common",
"version": "0.6.3", "version": "0.6.4",
"description": "MiaoScript api package", "description": "MiaoScript api package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,7 +24,7 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/nashorn": "^0.6.3" "@ccms/nashorn": "^0.6.4"
}, },
"gitHead": "562e2d00175c9d3a99c8b672aa07e6d92706a027" "gitHead": "562e2d00175c9d3a99c8b672aa07e6d92706a027"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/core", "name": "@ccms/core",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript api package", "description": "MiaoScript api package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,7 +24,7 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/api": "^0.6.3", "@ccms/api": "^0.6.5",
"@ccms/container": "^0.6.0" "@ccms/container": "^0.6.0"
}, },
"gitHead": "781524f83e52cad26d7c480513e3c525df867121" "gitHead": "781524f83e52cad26d7c480513e3c525df867121"

View File

@@ -43,14 +43,14 @@ class MiaoScriptCore {
console.i18n("ms.core.plugin.initialize") console.i18n("ms.core.plugin.initialize")
this.pluginManager.scan(this.pluginFolder) this.pluginManager.scan(this.pluginFolder)
this.pluginManager.build() this.pluginManager.build()
this.pluginManager.load() this.pluginManager.load(this.pluginManager.getPlugins())
this.pluginManager.enable() this.pluginManager.enable(this.pluginManager.getPlugins())
console.i18n("ms.core.plugin.completed", { time: (new Date().getTime() - loadPluginStartTime) / 1000 }) console.i18n("ms.core.plugin.completed", { time: (new Date().getTime() - loadPluginStartTime) / 1000 })
} }
disable() { disable() {
console.i18n("ms.core.engine.disable") console.i18n("ms.core.engine.disable")
this.pluginManager.disable() this.pluginManager.disable(this.pluginManager.getPlugins())
this.taskManager.disable() this.taskManager.disable()
//@ts-ignore //@ts-ignore
require.disable() require.disable()

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/i18n", "name": "@ccms/i18n",
"version": "0.6.3", "version": "0.6.4",
"description": "MiaoScript i18n package", "description": "MiaoScript i18n package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -25,7 +25,7 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/nashorn": "^0.6.3", "@ccms/nashorn": "^0.6.4",
"js-yaml": "^3.13.1" "js-yaml": "^3.13.1"
}, },
"gitHead": "781524f83e52cad26d7c480513e3c525df867121" "gitHead": "781524f83e52cad26d7c480513e3c525df867121"

View File

@@ -0,0 +1,22 @@
test
typings
bundled
build
coverage
docs
wiki
gulpfile.js
bower.json
karma.conf.js
tsconfig.json
typings.json
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
tslint.json
wallaby.js
.travis.yml
.gitignore
.vscode
.theia
type_definitions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/nashorn", "name": "@ccms/nashorn",
"version": "0.6.3", "version": "0.6.4",
"description": "MiaoScript api package", "description": "MiaoScript api package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/nodejs", "name": "@ccms/nodejs",
"version": "0.6.3", "version": "0.6.4",
"description": "MiaoScript nodejs package", "description": "MiaoScript nodejs package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,7 +24,7 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/nashorn": "^0.6.3" "@ccms/nashorn": "^0.6.4"
}, },
"gitHead": "781524f83e52cad26d7c480513e3c525df867121" "gitHead": "781524f83e52cad26d7c480513e3c525df867121"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/nukkit", "name": "@ccms/nukkit",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript nukkit package", "description": "MiaoScript nukkit package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,8 +24,8 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/api": "^0.6.3", "@ccms/api": "^0.6.5",
"@ccms/common": "^0.6.3", "@ccms/common": "^0.6.4",
"@ccms/container": "^0.6.0" "@ccms/container": "^0.6.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/ployfill", "name": "@ccms/ployfill",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript ployfill package", "description": "MiaoScript ployfill package",
"author": "MiaoWoo <admin@yumc.pw>", "author": "MiaoWoo <admin@yumc.pw>",
"homepage": "https://github.com/circlecloud/ms.git", "homepage": "https://github.com/circlecloud/ms.git",
@@ -14,8 +14,8 @@
"test": "echo \"Error: run tests from root\" && exit 1" "test": "echo \"Error: run tests from root\" && exit 1"
}, },
"dependencies": { "dependencies": {
"@ccms/i18n": "^0.6.3", "@ccms/i18n": "^0.6.4",
"@ccms/nashorn": "^0.6.3", "@ccms/nashorn": "^0.6.4",
"core-js": "^3.6.4" "core-js": "^3.6.4"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -6,6 +6,7 @@ i18n.initialize();
console.i18n("ms.ployfill.initialize"); console.i18n("ms.ployfill.initialize");
require('./es5-ext'); require('./es5-ext');
require('core-js'); require('core-js');
require('./node-shim');
global.setGlobal('Proxy', require('./proxy').Proxy) global.setGlobal('Proxy', require('./proxy').Proxy)
global.setGlobal('XMLHttpRequest', require('./xml-http-request').XMLHttpRequest) global.setGlobal('XMLHttpRequest', require('./xml-http-request').XMLHttpRequest)
global.setGlobal('Blob', require('blob-polyfill').Blob) global.setGlobal('Blob', require('blob-polyfill').Blob)

View File

@@ -0,0 +1,8 @@
global.setGlobal('process', {
env: {
__noSuchProperty__: (prop) => {
return Packages.java.lang.System.getenv(prop)
}
},
platform: Packages.java.lang.System.getProperty("os.name")
}, {})

View File

@@ -82,10 +82,12 @@ export class XMLHttpRequest {
private _url: string; private _url: string;
private _async: boolean; private _async: boolean;
private _mimeType: string; private _mimeType: string;
private _requestHeaders: HttpHeader = {};
private _status: number = 0; private _status: number = 0;
private _statusText: string = null; private _statusText: string = null;
private _response: any; private _response: any;
private _responseText: any;
private _responseURL: string; private _responseURL: string;
private _responseHeaders: HttpHeader = {}; private _responseHeaders: HttpHeader = {};
@@ -114,10 +116,10 @@ export class XMLHttpRequest {
return this._statusText; return this._statusText;
} }
get response() { get response() {
return this._response ? JSON.parse(this._response) : this._response; return this._response || this.get();
} }
get responseText() { get responseText() {
return this._response; return this._responseText;
} }
get responseXML() { get responseXML() {
return this._response; return this._response;
@@ -126,17 +128,17 @@ export class XMLHttpRequest {
return this._responseURL; return this._responseURL;
} }
onload() { } public onload: () => void;
onerror(ex: Error) { } public onerror: (ex: Error) => void;
onabort() { } public onabort: () => void;
onprogress() { } public onprogress: () => void;
ontimeout(ex: Error) { } public ontimeout: (ex: Error) => void;
onloadend() { } public onloadend: () => void;
onloadstart() { } public onloadstart: () => void;
onreadystatechange() { } public onreadystatechange: () => void;
setRequestHeader(key: string, val: string) { setRequestHeader(key: string, val: string) {
this._connection.setRequestProperty(key, val); this._requestHeaders[key] = val;
} }
getResponseHeader(key: string): string { getResponseHeader(key: string): string {
return this._responseHeaders[key]; return this._responseHeaders[key];
@@ -171,30 +173,36 @@ export class XMLHttpRequest {
this.setReadyState(ReadyState.OPENED); this.setReadyState(ReadyState.OPENED);
} }
send(body?: string | object): Future<string> { send(body?: string | object): Future<string> {
for (const header in this._requestHeaders) {
this._connection.setRequestProperty(header, this._requestHeaders[header]);
}
if (this._readyState !== ReadyState.OPENED) { throw new Error(`Error Status ${this._readyState}!`) } if (this._readyState !== ReadyState.OPENED) { throw new Error(`Error Status ${this._readyState}!`) }
let future = executor.submit(new Callable({ call: () => this._send(body) })); let future = executor.submit(new Callable({ call: () => this._send(body) }));
if (!this._async) { future.get() } if (!this._async) { future.get() }
return future; return future;
} }
get() { get() {
switch (this._responseType) { if (this._response === undefined) {
case "json": switch (this._responseType) {
return this.response; case "json":
case "text": return this._response = JSON.parse(this._responseText);
return this.responseText; case "text":
default: return this._response = this._responseText;
throw Error(`Unsupport ResponseType: ${this._responseType} !`) default:
throw Error(`Unsupport ResponseType: ${this._responseType} !`)
}
} }
return this._response;
} }
abort() { abort() {
this._connection.disconnect(); this._connection.disconnect();
this.onabort(); this.onabort && this.onabort();
} }
private _send(body?: string | object) { private _send(body?: string | object) {
try { try {
this._connection.connect(); this._connection.connect();
this.onloadstart(); this.onloadstart && this.onloadstart();
if (body) { if (body) {
let bodyType = Object.prototype.toString.call(body); let bodyType = Object.prototype.toString.call(body);
if (typeof body !== "string") { throw new Error(`body(${bodyType}) must be string!`) } if (typeof body !== "string") { throw new Error(`body(${bodyType}) must be string!`) }
@@ -207,14 +215,14 @@ export class XMLHttpRequest {
this._status = this._connection.getResponseCode(); this._status = this._connection.getResponseCode();
this._statusText = this._connection.getResponseMessage(); this._statusText = this._connection.getResponseMessage();
if (this._status >= 0 && this._status < 300) { if (this._status >= 0 && this._status < 300) {
this._response = this.readOutput(this._connection.getInputStream()); this._responseText = this.readOutput(this._connection.getInputStream());
} else if (this._status >= 300 && this._status < 400) { } else if (this._status >= 300 && this._status < 400) {
this._responseURL = this.getResponseHeader('Location'); this._responseURL = this.getResponseHeader('Location');
} else { } else {
this._response = this.readOutput(this._connection.getErrorStream()); this._responseText = this.readOutput(this._connection.getErrorStream());
} }
this.setResponseHeaders(this._connection.getHeaderFields()); this.setResponseHeaders(this._connection.getHeaderFields());
this.onloadend(); this.onloadend && this.onloadend();
} catch (ex) { } catch (ex) {
if (ex instanceof SocketTimeoutException && this.ontimeout) { if (ex instanceof SocketTimeoutException && this.ontimeout) {
return this.ontimeout(ex) return this.ontimeout(ex)
@@ -236,7 +244,7 @@ export class XMLHttpRequest {
private setReadyState(state: ReadyState) { private setReadyState(state: ReadyState) {
this._readyState = state; this._readyState = state;
this.onreadystatechange(); this.onreadystatechange && this.onreadystatechange();
} }
private readOutput(input: any) { private readOutput(input: any) {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/plugin", "name": "@ccms/plugin",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript api package", "description": "MiaoScript api package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -25,10 +25,10 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/api": "^0.6.3", "@ccms/api": "^0.6.5",
"@ccms/common": "^0.6.3", "@ccms/common": "^0.6.4",
"@ccms/container": "^0.6.0", "@ccms/container": "^0.6.0",
"@ccms/i18n": "^0.6.3", "@ccms/i18n": "^0.6.4",
"js-yaml": "^3.13.1" "js-yaml": "^3.13.1"
} }
} }

View File

@@ -123,7 +123,7 @@ export class PluginManagerImpl implements plugin.PluginManager {
} }
private checkAndGet(name: string | interfaces.Plugin | undefined | any): Map<string, interfaces.Plugin> | interfaces.Plugin[] { private checkAndGet(name: string | interfaces.Plugin | undefined | any): Map<string, interfaces.Plugin> | interfaces.Plugin[] {
if (name == undefined) { return this.pluginInstanceMap } if (name == this.pluginInstanceMap) { return this.pluginInstanceMap }
if (typeof name == 'string' && this.pluginInstanceMap.has(name)) { return [this.pluginInstanceMap.get(name)] } if (typeof name == 'string' && this.pluginInstanceMap.has(name)) { return [this.pluginInstanceMap.get(name)] }
if (name instanceof interfaces.Plugin) { return [name as interfaces.Plugin] } if (name instanceof interfaces.Plugin) { return [name as interfaces.Plugin] }
if (name.description || name.description.name) { return [name as interfaces.Plugin] } if (name.description || name.description.name) { return [name as interfaces.Plugin] }

View File

@@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "@ccms/plugins", "name": "@ccms/plugins",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript plugins package", "description": "MiaoScript plugins package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -25,8 +25,8 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/api": "^0.6.3", "@ccms/api": "^0.6.5",
"@ccms/container": "^0.6.0", "@ccms/container": "^0.6.0",
"@ccms/plugin": "^0.6.3" "@ccms/plugin": "^0.6.5"
} }
} }

View File

@@ -9,18 +9,21 @@ import http from '@ccms/common/dist/http'
let help = [ let help = [
'§6========= §6[§aMiaoScriptPackageManager§6] 帮助 §aBy §bMiaoWoo §6=========', '§6========= §6[§aMiaoScriptPackageManager§6] 帮助 §aBy §bMiaoWoo §6=========',
'§6/mpm §ainstall §e<插件名称> §6- §3安装插件', '§6/mpm §ainstall §e<插件名称> §6- §3安装仓库插件',
'§6/mpm §auninstall §e<插件名称> §6- §3卸载插件', '§6/mpm §aload §e<插件名称> §6- §3安装本地插件',
'§6/mpm §alist [install]§6- §3列出仓库插件[已安装插件]', '§6/mpm §aunload §e<插件名称> §6- §3卸载已安装插件',
'§6/mpm §aupdate §e<插件名称> §6- §3更新插件(无插件名称则更新源)', '§6/mpm §areload §e<插件名称> §6- §3重载已安装插件(无名称则重载自身)',
'§6/mpm §aupgrade §e<插件名称> §6- §3及时更新插件(update需要重启生效)', '§6/mpm §alist [i] §6- §3列出仓库插件[已安装的插件]',
'§6/mpm §areload §e<插件名称> §6- §3重载插件(无插件名称则重载自身)', '§6/mpm §aupdate §e[插件名称] §6- §3更新插件(无名称则更新源)',
'§6/mpm §arun §e<JS代码> §6- §3运行JS代码', '§6/mpm §aupgrade §e[插件名称] §6- §3升级插件/框架(§4无名称则升级框架§3)',
'§6/mpm §adeploy §e<插件名称> §6- §3发布插件', '§6/mpm §arun §e<JS代码> §6- §3运行JS代码',
'§6/mpm §crestart §6- §4重启MiaoScript脚本引擎' '§6/mpm §adeploy §e<插件名称> §6- §3发布插件',
'§6/mpm §crestart §6- §4重启MiaoScript脚本引擎'
]; ];
let langMap = { let langMap = {
'main.command.not.exists': '§4未知的子命令: §c{command}',
'main.command.help.tip': '§6请执行 §b/{command} §ahelp §6查看帮助!',
'list.install.header': '§6当前 §bMiaoScript §6已安装下列插件:', 'list.install.header': '§6当前 §bMiaoScript §6已安装下列插件:',
'list.install.body': '§6插件名称: §b{name} §6版本: §a{version} §6作者: §3{author}', 'list.install.body': '§6插件名称: §b{name} §6版本: §a{version} §6作者: §3{author}',
'list.header': '§6当前 §bMiaoScriptPackageCenter §6中存在下列插件:', 'list.header': '§6当前 §bMiaoScriptPackageCenter §6中存在下列插件:',
@@ -36,8 +39,12 @@ let langMap = {
'download.finish': '§6插件 §b{name} §a下载完毕 开始加载 ...', 'download.finish': '§6插件 §b{name} §a下载完毕 开始加载 ...',
'install.finish': '§6插件 §b{name} §a安装成功!', 'install.finish': '§6插件 §b{name} §a安装成功!',
'update.finish': '§6插件 §b{name} §a更新成功!', 'update.finish': '§6插件 §b{name} §a更新成功!',
'deploy.token.not.exists': '§4请先配置发布Token!',
'deploy.success': '§6插件 §b{name} §a发布成功! §6服务器返回: §a{msg}', 'deploy.success': '§6插件 §b{name} §a发布成功! §6服务器返回: §a{msg}',
'deploy.fail': '§6插件 §b{name} §c发布失败! §6服务器返回: §c{msg}', 'deploy.fail': '§6插件 §b{name} §c发布失败! §6服务器返回: §c{msg}',
'run.script': '§b运行脚本:§r {script}',
'run.result': '§a返回结果:§r {result}',
'run.noresult': '§4没有返回结果!',
} }
let fallbackMap = langMap let fallbackMap = langMap
@@ -80,22 +87,22 @@ export class MiaoScriptPackageManager extends interfaces.Plugin {
main(sender: any, command: string, args: string[]) { main(sender: any, command: string, args: string[]) {
let cmdKey = 'cmd' + args[0] let cmdKey = 'cmd' + args[0]
if (!this[cmdKey]) { if (!this[cmdKey]) {
this.logger.sender(sender, '§4未知的子命令: §c' + args[0]) this.i18n(sender, 'main.command.not.exists', { command: args[0] })
this.logger.sender(sender, '§6请执行 §b/' + command + ' §ahelp §6查看帮助!') this.i18n(sender, 'main.command.help.tip', { command })
return;
}
if (args[0] === 'help') {
this.logger.sender(sender, help);
return; return;
} }
args.shift() args.shift()
this[cmdKey](sender, ...args); this[cmdKey](sender, ...args);
} }
cmdhelp(sender: any) {
this.logger.sender(sender, help);
}
cmdload(sender: any, name: string) { cmdload(sender: any, name: string) {
let pluginFile = fs.concat(__dirname + '', name); let pluginFile = fs.concat(__dirname + '', name);
if (!fs.exists(pluginFile)) { if (!fs.exists(pluginFile)) {
this.logger.sender(sender, '§4插件 §c' + pluginFile + ' §4不存在!') this.i18n(sender, 'plugin.not.exists', { name: `${name}(${pluginFile})` })
return; return;
} }
this.pluginManager.loadFromFile(fs.file(pluginFile)); this.pluginManager.loadFromFile(fs.file(pluginFile));
@@ -189,18 +196,19 @@ export class MiaoScriptPackageManager extends interfaces.Plugin {
cmdrun(sender: any, ...args: any[]) { cmdrun(sender: any, ...args: any[]) {
try { try {
var script = args.join(' '); var script = args.join(' ');
this.logger.sender(sender, '§b运行脚本:§r', script); this.i18n(sender, 'run.script', { script })
this.logger.sender(sender, '§a返回结果:§r', eval(script) || '§4没有返回结果!'); this.i18n(sender, 'run.result', { result: eval(script) || this.translate.translate('run.noresult') })
} catch (ex) { } catch (ex) {
this.logger.sender(sender, this.logger.stack(ex)); this.logger.sender(sender, this.logger.stack(ex));
} }
} }
cmddeploy(sender: any, name: any) { cmddeploy(sender: any, name: any) {
if (!process.env.AccessToken) { return this.i18n(sender, 'deploy.token.not.exists') }
this.taskManager.create(() => { this.taskManager.create(() => {
if (this.checkPlugin(sender, name)) { if (this.checkPlugin(sender, name)) {
let plugin: interfaces.Plugin = this.pluginManager.getPlugins().get(name); let plugin: interfaces.Plugin = this.pluginManager.getPlugins().get(name);
let result = http.post("http://ms.yumc.pw/api/plugin/deploy", { let result = http.post("http://ms.yumc.pw/api/plugin/deploy?access_token=" + process.env.AccessToken, {
name, name,
author: plugin.description.author, author: plugin.description.author,
version: plugin.description.version, version: plugin.description.version,

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/sponge", "name": "@ccms/sponge",
"version": "0.6.3", "version": "0.6.5",
"description": "MiaoScript api package", "description": "MiaoScript api package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,8 +24,8 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/api": "^0.6.3", "@ccms/api": "^0.6.5",
"@ccms/common": "^0.6.3", "@ccms/common": "^0.6.4",
"@ccms/container": "^0.6.0" "@ccms/container": "^0.6.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ccms/websocket", "name": "@ccms/websocket",
"version": "0.6.3", "version": "0.6.4",
"description": "MiaoScript websocket package", "description": "MiaoScript websocket package",
"keywords": [ "keywords": [
"miaoscript", "miaoscript",
@@ -24,6 +24,6 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"dependencies": { "dependencies": {
"@ccms/nashorn": "^0.6.3" "@ccms/nashorn": "^0.6.4"
} }
} }