This commit is contained in:
cdle
2023-06-11 19:58:21 +08:00
parent 23cbd154ed
commit 29e4fc8c9e
15 changed files with 64 additions and 48 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -8,6 +8,6 @@
</head>
<body>
<div id="root"></div>
<script src="/admin/umi.5b7a19c7.js"></script>
<script src="/admin/umi.c7cba927.js"></script>
</body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[398],{25367:function(r,e,_){var l=_(68243),s=_(86981),a=_(11527),u=function(){return(0,a.jsxs)(l.Z,{size:"middle",children:[(0,a.jsx)(s.Z,{size:"small"}),(0,a.jsx)(s.Z,{}),(0,a.jsx)(s.Z,{size:"large"})]})};e.Z=u},34316:function(r,e,_){var l=_(86195),s=_(21362),a=function(){s.ZP.warning("\u767B\u5F55\u5931\u6548\uFF01",2);var o=new URL(window.location.href).searchParams,E=o.get("redirect");window.location.pathname!=="/user/login"&&!E&&l.history.replace({pathname:"/user/login"})};e.Z=a},72392:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);var _Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(54689),_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0__),_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(25359),_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__),_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(49811),_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__),_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(54306),_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__),_pages_Loading__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(25367),_pages_LoginPage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(34316),_pages_submit__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(87474),_monaco_editor_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(10217),_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(12472),_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(81308),_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(48989),_umijs_max__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(86195),antd__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(26572),antd__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(79112),react__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(50959),lodash__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(32699),lodash__WEBPACK_IMPORTED_MODULE_10___default=__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_10__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(11527),empty="???xxxooxox",demoScript=`/**
* @title \u65E0\u540D\u811A\u672C
*/`,Script=function(e){var _,l,s=(0,_umijs_max__WEBPACK_IMPORTED_MODULE_8__.useModel)("@@initialState"),a=s.initialState,u=s.refresh,o=(0,react__WEBPACK_IMPORTED_MODULE_9__.useState)(!1),E=_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(o,2),f=E[0],b=E[1],g=(0,react__WEBPACK_IMPORTED_MODULE_9__.useState)(empty),D=_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(g,2),m=D[0],P=D[1],p=(0,react__WEBPACK_IMPORTED_MODULE_9__.useRef)(null),n=a==null||(_=a.currentUser)===null||_===void 0?void 0:_.plugins[(a==null||(l=a.currentUser)===null||l===void 0?void 0:l.plugins.length)-1].path,v=n.indexOf(e.id)!=-1,d=(0,_umijs_max__WEBPACK_IMPORTED_MODULE_8__.useRequest)(function(){return v?new Promise(function(c){var t={success:!0};t["plugins."+e.id]="",c(t)}):(0,_umijs_max__WEBPACK_IMPORTED_MODULE_8__.request)("/api/storage",{params:{keys:["plugins."+e.id].join(",")}})}),L=d.data,i=d.error,M=d.loading;if(M)return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_pages_Loading__WEBPACK_IMPORTED_MODULE_4__.Z,{});if(i)return(0,_pages_LoginPage__WEBPACK_IMPORTED_MODULE_5__.Z)(),null;m==empty&&P(v?demoScript:L["plugins."+e.id]);var U=function(){var c=_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()(_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function t(){var A,I,R,C;return _Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return A=p.current?p.current.getValue().replace(/\r\n/g,`
`):m,I={},I["plugins."+e.id]=A,O.next=5,(0,_pages_submit__WEBPACK_IMPORTED_MODULE_6__.Z)(I);case 5:R=O.sent,C=R==null?void 0:R.messages["plugins."+e.id],C?C=="\u6807\u9898\u53D8\u66F4\u3002"?u():P(C):v?u():A==""&&(_umijs_max__WEBPACK_IMPORTED_MODULE_8__.history.push(n),u());case 8:case"end":return O.stop()}},t)}));return function(){return c.apply(this,arguments)}}(),T=function(t){t.key==="s"&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),U())};return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_12__._z,{extra:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__.ZP,{type:"primary",onClick:function(){b(!0)},children:"\u8868\u5355"},"2"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__.ZP,{type:"primary",onClick:U,children:"\u4FDD\u5B58"},"1")],children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div",{onKeyDown:T,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_monaco_editor_react__WEBPACK_IMPORTED_MODULE_7__.ZP,{defaultLanguage:"javascript",value:m,height:"1000px",options:{fontSize:12,lineNumbersMinChars:3,folding:!1,glyphMargin:!1},onMount:function(t){p.current=t}})}),f&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(MyModal,{data:{id:e.id,script:m},open:f,onCancel:function(){b(!1)},editorRef:p})]})};__webpack_exports__.default=function(){var r=(0,_umijs_max__WEBPACK_IMPORTED_MODULE_8__.useParams)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(Script,{id:r.id},r.id)};function MyModal(props){for(var content=props.editorRef.current?props.editorRef.current.getValue().replace(/\r\n/g,`
`):"",formRef=(0,react__WEBPACK_IMPORTED_MODULE_9__.useRef)(),result=[],keys=[],_i=0,_arr=[/@form\s+({[^*]+?})/g,/Form\(([\s\S]+?)\)/g];_i<_arr.length;_i++){var pattern=_arr[_i],matches=content.matchAll(pattern),_iterator=_Users_cdle_Desktop_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0___default()(matches),_step;try{var _loop=function _loop(){var match=_step.value;try{var _a=function(e){for(var _ in e)e[_].dataIndex&&(e[_].key=e[_].dataIndex),e[_].key&&keys.push(e[_].key),e[_].required&&!e[_].formItemProps&&(e[_].formItemProps={rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]}),e[_].columns&&(e[_].columns=_a(e[_].columns));return e},formObject=eval("(".concat(match[1],")"));(0,lodash__WEBPACK_IMPORTED_MODULE_10__.isArray)(formObject)||(formObject=[formObject]),result=result.concat(formObject),keys=[],result=_a(result)}catch(r){console.log("form\u8868\u5355\u89E3\u6790\u9519\u8BEF",r)}};for(_iterator.s();!(_step=_iterator.n()).done;)_loop()}catch(r){_iterator.e(r)}finally{_iterator.f()}}return(0,react__WEBPACK_IMPORTED_MODULE_9__.useEffect)(function(){(0,_umijs_max__WEBPACK_IMPORTED_MODULE_8__.request)("/api/storage",{params:{keys:keys.join(",")}}).then(function(r){if(r&&r.data){var e;for(var _ in r.data)r.data[_]=="false"&&(r.data[_]=!1),r.data[_]==""&&delete r.data[_];(e=formRef.current)===null||e===void 0||e.setFieldsValue(r.data)}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__.Z,{open:props.open,onCancel:props.onCancel,onOk:function r(){var e,_=formRef==null||(e=formRef.current)===null||e===void 0?void 0:e.getFieldsValue();(0,_pages_submit__WEBPACK_IMPORTED_MODULE_6__.Z)(_).finally(function(){props.onCancel()})},children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_15__.A,{formRef,submitter:!1,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_16__.Z,{layoutType:"Embed",columns:result})})})}},87474:function(r,e,_){var l=_(25359),s=_.n(l),a=_(49811),u=_.n(a),o=_(21362),E=_(86195),f=function(){var b=u()(s()().mark(function g(D){var m,P,p,n=arguments;return s()().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return m=n.length>1&&n[1]!==void 0?n[1]:"\u6B63\u5728\u63D0\u4EA4\u66F4\u6539..",P=n.length>2&&n[2]!==void 0?n[2]:"\u63D0\u4EA4\u6210\u529F\uFF01",p=n.length>3&&n[3]!==void 0?n[3]:"\u63D0\u4EA4\u5931\u8D25",m&&o.ZP.loading("\u6B63\u5728\u63D0\u4EA4\u66F4\u6539..",2e4),d.abrupt("return",new Promise(function(L){(0,E.request)("/api/storage",{method:"put",data:D}).then(function(i){var M;if(o.ZP.destroy(),(i==null||(M=i.data)===null||M===void 0?void 0:M.isLogin)==!1){o.ZP.warning("\u767B\u5F55\u5931\u6548\uFF01",2);var U=new URL(window.location.href).searchParams,T=U.get("redirect");window.location.pathname!=="/user/login"&&!T&&E.history.replace({pathname:"/user/login"});return}i!=null&&i.success?P&&o.ZP.success(P,1):p&&o.ZP.warning("\u63D0\u4EA4\u5931\u8D25\uFF01",2),L(i)})}));case 5:case"end":return d.stop()}},g)}));return function(D){return b.apply(this,arguments)}}();e.Z=f}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -32,10 +32,11 @@ type Function struct {
Encrypt bool `json:"encrypt"`
OnStart bool `json:"on_start"`
PluginPublisher
Running bool `json:"-"`
Running bool `json:"running"`
Http *Http `json:"-"`
Reply *Reply `json:"-"`
Downloads int `json:"downloads"`
HasForm bool `json:"has_form"`
}
type Filter struct {
BlackMode bool
+3
View File
@@ -42,6 +42,9 @@ func init() {
group = false
}
}
if keyword == "" && strings.Contains(ctx.Request.URL.String(), "ukeyword") {
group = false
}
platform := ctx.Query("platform")
data := []NicklabeL{}
data2 := []NicklabeL{}
+7 -3
View File
@@ -260,6 +260,7 @@ func initPlugin(data string, uuid string) (*common.Function, error) {
var http *common.Http
var message *common.Reply
var FindAll bool
var hasForm bool
ress := regexp.MustCompile(
`\*\s?@([\d\w+-]+)\s+([^\n]+?)\n`,
).FindAllStringSubmatch(data, -1)
@@ -423,6 +424,8 @@ func initPlugin(data string, uuid string) (*common.Function, error) {
encrypt = strings.TrimSpace(res[2]) == "true"
case "on_start":
onStart = strings.TrimSpace(res[2]) == "true"
case "form":
hasForm = true
}
}
script := ""
@@ -444,9 +447,9 @@ func initPlugin(data string, uuid string) (*common.Function, error) {
if web {
onStart = true
}
if icon == "" {
icon = "https://joeschmoe.io/api/v1/random?t=" + fmt.Sprint(time.Now().Nanosecond())
}
// if icon == "" {
// icon = "https://joeschmoe.io/api/v1/random?t=" + fmt.Sprint(time.Now().Nanosecond())
// }
var running func() bool
f := &common.Function{
Handle: func(s common.Sender, set func(vm *goja.Runtime)) interface{} {
@@ -553,6 +556,7 @@ func initPlugin(data string, uuid string) (*common.Function, error) {
Reply: message,
Http: http,
FindAll: FindAll,
HasForm: hasForm,
}
running = func() bool {
return f.Running
+6
View File
@@ -170,6 +170,12 @@ func initWebPluginList() {
// if rr.Data[i].MachineID == machine_id {
// rr.Data[i].MachineID = ""
// }
if rr.Data[i].Icon == "" {
rr.Data[i].Icon = "https://blog.imdraw.com/huli.jpeg"
}
if fc[j].Running {
rr.Data[i].Running = fc[j].Running
}
}
}
}