mirror of
https://gitee.com/BDWare/cp.git
synced 2025-04-26 22:22:16 +00:00
update yjscompiler
This commit is contained in:
parent
05e301d9e9
commit
7f81dba895
@ -1,6 +1,8 @@
|
||||
{
|
||||
"agentHttpAddr": "127.0.0.1:18000",
|
||||
"script": "/Users/huaqiancai/BDWare/datanet/datanet-gateway-bundle/datanet-gateway-backend/build/gateway.ypk",
|
||||
"pubKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd",
|
||||
"privKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8"
|
||||
"agentAddress": "127.0.0.1:18000",
|
||||
"ypkPath": "/Users/huaqiancai/BDWare/datanet/datanet-gateway-bundle/datanet-gateway-backend/build/gateway.ypk",
|
||||
"privateKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd",
|
||||
"publicKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8",
|
||||
"killBeforeStart":"ContractName",
|
||||
"createParam":{}
|
||||
}
|
@ -557,6 +557,9 @@ public class ContractProcess {
|
||||
if (argSchemaHandler != null) {
|
||||
fun.appendBeforeInvokeHandler(argSchemaHandler);
|
||||
}
|
||||
if (fun.functionName.equals("onCreate")){
|
||||
fun.appendAfterInvokeHandler(new ObjToJsonHandler());
|
||||
}
|
||||
if (fun.isExport()) {
|
||||
//if(fun.annotations...)
|
||||
AccessHandler accessHandler = createHandlerIfExist(fun,fun.annotations,AccessHandler.class);
|
||||
|
@ -131,7 +131,8 @@ public class YJSCompiler {
|
||||
if (czb.containsPath(str)) {
|
||||
continue;
|
||||
}
|
||||
ZipEntry entry = zf.getEntry("/" + str);
|
||||
|
||||
ZipEntry entry = zf.getEntry(str.startsWith("/") ? str : "/" + str);
|
||||
if (null == entry) {
|
||||
throw new IllegalStateException("missing import:" + str);
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
package org.bdware.sc.engine;
|
||||
|
||||
import com.google.gson.*;
|
||||
import jdk.nashorn.internal.runtime.Context;
|
||||
import wrp.jdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||
import wrp.jdk.nashorn.internal.objects.NativeArray;
|
||||
import wrp.jdk.nashorn.internal.runtime.PropertyMap;
|
||||
import wrp.jdk.nashorn.internal.runtime.ScriptObject;
|
||||
import wrp.jdk.nashorn.internal.scripts.JO;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class JSONTool {
|
||||
public static JsonElement convertMirrorToJson(Object ret2) {
|
||||
@ -140,15 +141,15 @@ public class JSONTool {
|
||||
return JsonNull.INSTANCE;
|
||||
} else if (obj instanceof Number) {
|
||||
return new JsonPrimitive((Number) obj);
|
||||
|
||||
} else if (obj instanceof String) {
|
||||
return new JsonPrimitive((String) obj);
|
||||
|
||||
} else if (obj instanceof Character) {
|
||||
return new JsonPrimitive((Character) obj);
|
||||
}
|
||||
if (obj instanceof Boolean) {
|
||||
} else if (obj instanceof Boolean) {
|
||||
return new JsonPrimitive((Boolean) obj);
|
||||
} else if (obj.getClass() == Boolean.TYPE) {
|
||||
return new JsonPrimitive((boolean) obj);
|
||||
|
||||
}
|
||||
return JsonNull.INSTANCE;
|
||||
}
|
||||
|
@ -46,16 +46,14 @@ public class AccessHandler implements AnnotationHook {
|
||||
}
|
||||
return argPacks;
|
||||
}
|
||||
if (!argPacks.request.verifySignature()){
|
||||
argPacks.request.setRequester(null);
|
||||
}
|
||||
if (acFunction == null) return argPacks;
|
||||
DesktopEngine de = (DesktopEngine) desktopEngine;
|
||||
Global oldGlobal = Context.getGlobal();
|
||||
Global newGlobal = de.getDesktopGlobal();
|
||||
boolean globalChanged = (oldGlobal != newGlobal);
|
||||
|
||||
try {
|
||||
if (globalChanged) {
|
||||
Context.setGlobal(newGlobal);
|
||||
}
|
||||
ContractRequest input = argPacks.request;
|
||||
ContractRequest input = argPacks.request;
|
||||
JO jo = new JO(PropertyMap.newMap());
|
||||
jo.put("requester", input.getRequester(), false);
|
||||
jo.put("action", input.getAction(), false);
|
||||
@ -69,9 +67,6 @@ public class AccessHandler implements AnnotationHook {
|
||||
jo.addProperty("code", "401");
|
||||
jo.addProperty("msg", "access check meets exception! " + e);
|
||||
throw new ScriptReturnException(jo);
|
||||
} finally {
|
||||
if (globalChanged) Context.setGlobal(oldGlobal);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user