配置文件为固定的文件名:setting.json
该文件可以放在任意目录下,为系统或目录内的所有文件提供统一管理功能:
{
"desc": "",
"version": 1989,//系统版本控制
"https": true,//系统只允许https访问
"www": true,//域名www
"ByteLimit": "100MB",//系统字节访问限制
"MainPage": "/admin/home/index",//域名访问后的主页
//"ErrorPage": "/admin/errorpage",//访问出错页
"upgradepkg": "admin/__system__/WORKER.zip", //window自动升级文件
"linux_upgradepkg": "", ///admin/__system__/linux/linux-x64.zip //linux自动升级文件
//特殊的后缀内容类型定义
"MimeType": {
".data.gz": {
"Content-Encoding": "gzip",
"Content-Type": "application/octet-stream"
},
".wasm.gz": {
"Content-Encoding": "gzip",
"Content-Type": "application/wasm"
},
".js.gz": {
"Content-Encoding": "gzip",
"Content-Type": "application/javascript"
},
".symbols.json.gz": {
"Content-Encoding": "gzip",
"Content-Type": "application/octet-stream"
}
},
//忽略的日志,只要日志内容包含定义的内容就忽略该日志
"IgnoreLog": [
"服务[HttpTLS]达到最大连接数"
],
//自动升级忽略的机器id
"ignore": [
"1",
"2"
],
//服务处理程序配置
"MyProcess": {
"mqtt": {
"login": "/admin/mqtt/login.ds",
"topic": "/admin/mqtt/topic.ds",
"close": "/admin/mqtt/closed.ds"
},
"Modbus": {
//"process": "/admin/订阅控制.ds()"
},
"QianFeng": {
"process": "/admin/device/process.ds"
},
"ZhengZhou": {
"process": "/admin/device/process.ds"
},
"gd": {
"process": "/admin/ship/script/process.ds",
"close": ""
}
},
// "MyMapping": {
// "Server": "http://192.168.0.107:801|qianfeng|123456",
// "Instances": {
// "/qianfeng/test/mydata.obj.a": "/admin/mydata.obj.data"
// }
// },
//允许的跨域配置
"AccessControl": {
"Origin": "*", // "http://localhost:8090",
"Credentials": "false",
"Methods": "POST, GET",
"MaxAge": "3600",
"Headers": "content-type",
//"TokenHeader": "token"
"Access": ""
},
// "function": [
// "/admin/__system__/QRCodeActivity.zip"
// ],
//权限组
"group": {
"a": {
"name": "管理员",
"users": "admin,will,*"
},
"b": "robin,ency",
"c": {
"name": "管理员",
"users": "*",
"process": "/admin/api/test/process.ds"
}
},
//允许公开访问的目录或文件
//格式1:目录或文件:用户1,用户2
//格式2:目录或文件:$权限组
//格式3:目录或文件:/admin/aaa.ds(表示通过执行一个脚本判断)
"public": [
"/admin/系统模板/",
"/admin/DataTable/",
"/admin/device/process.ds",
],
//不允许公开访问的目录或文件
"private": [
//"/admin/MonacoEditor/script/notify.ds"
],
//允许读取内容的目录或文件
"read": [
//"/admin/setting.json:ency"
],
//允许写入的目录或文件
"write": [
//"/admin/setting.json:ency"
],
//缺省路由文件入口
"default": [
"index",
"index.html"
],
///$/a/b.ds 这里$代表如下配置的内容
"dspath": "/this/home/dsscripts",
//自定义功能的dll文件
"dlls": [
// "/admin/dlls/ExcelProvider.dll",
// "/admin/dlls/CppProvider.dll",
//"/admin/dlls/ExcelWriter.dll",
""
]
}
目录或文件:/admin/aaa.ds(表示通过执行一个脚本判断)
var input = input();
//console.log(input);
input["filename"] //访问的文件名
input["user"] //访问的当前用户
input["flag"] //访问的标识:public/private/write
input["fileid"] //访问的文件id
input["owner"] //访问的文件拥有者
return false;//表示没权限
return true;//表示有权限