From 9c15c81d618b943dd294bd453c6f645d9985be06 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 31 Jul 2025 16:56:58 +0800 Subject: [PATCH 1/5] bugfix --- json/downapp.json | 1 + 1 file changed, 1 insertion(+) diff --git a/json/downapp.json b/json/downapp.json index 5bad4ef..5d061b5 100644 --- a/json/downapp.json +++ b/json/downapp.json @@ -62,6 +62,7 @@ "url":"{{entire_url('/dapi/copy_apikey.ui')}}" } } + ] } } From 5e94ed35c2589ee3e71b09365a88b2649a266bb9 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 31 Jul 2025 17:10:00 +0800 Subject: [PATCH 2/5] bugfix --- dapi/__init__.py | 0 setup.cfg | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 dapi/__init__.py diff --git a/dapi/__init__.py b/dapi/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.cfg b/setup.cfg index 2135e94..88f53fa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name=kyapikeyclient +name=dapi version = 0.0.2 description = Your project description author = "yu moqing" From 27c1c832b24512e98ab018e5494e92ea0dc4a7fe Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 31 Jul 2025 17:37:21 +0800 Subject: [PATCH 3/5] bugfix --- json/downapp.json | 9 +-------- wwwroot/copy_apikey.dspy | 4 ++-- wwwroot/create_apikey.dspy | 10 +++++----- wwwroot/create_apikey.ui | 4 ++-- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/json/downapp.json b/json/downapp.json index 5d061b5..8c54d55 100644 --- a/json/downapp.json +++ b/json/downapp.json @@ -6,18 +6,11 @@ "confidential_fields":["secretkey"], "noedit":true, "browserfields": { - "exclouded": ["id", "secretkey" ], + "exclouded": ["id", "secretkey", "orgid" ], "alters": {} }, "editexclouded": [ - ], - "subtables": [ - { - "field":"appid", - "title":"apikey", - "subtable":"downapikey" - } ], "toolbar":{ "tools":[ diff --git a/wwwroot/copy_apikey.dspy b/wwwroot/copy_apikey.dspy index ef45877..867a20b 100644 --- a/wwwroot/copy_apikey.dspy +++ b/wwwroot/copy_apikey.dspy @@ -1,5 +1,5 @@ debug(f'{params_kw=}') -dbname = get_module_dbname() +dbname = get_module_dbname('dapi') db = DBPools() async with db.sqlorContext(dbname) as sor: orgid = await get_userorgid() @@ -19,5 +19,5 @@ where a.id = b.dappid recs = await sor.sqlExe(sql, ns) if len(recs): r = recs[0] - return UiMessage(title="copy apikey", message=f'appid={r.id}, apikey={r.apikey} secretkey={r.secretkey}') + return UiMessage(title="copy apikey", message=f"appid={r.id}, apikey={r.apikey} secretkey={r.secretkey}") return UiError(title='copy apikey', message='copy apikey error') diff --git a/wwwroot/create_apikey.dspy b/wwwroot/create_apikey.dspy index 05f33e4..db1475f 100644 --- a/wwwroot/create_apikey.dspy +++ b/wwwroot/create_apikey.dspy @@ -1,20 +1,20 @@ debug(f'{params_kw=}') -dbname = get_module_dbname() +dbname = get_module_dbname('dapi') db = DBPools() async with db.sqlorContext(dbname) as sor: orgid = await get_userorgid() userid = await get_user() ns = { "id": uuid(), - "name": params_kw.name, + "name": params_kw.appname, "description": params_kw.description, "secretkey": uuid(), - "allowedips": params_kw.allowips, + "allowedips": params_kw.allowedips, "orgid": orgid } await sor.C('downapp', ns) ns1 = { - "id": uuid() + "id": uuid(), "dappid": ns['id'], "userid": userid, "apikey": uuid(), @@ -22,5 +22,5 @@ async with db.sqlorContext(dbname) as sor: "expired_date": '9999-12-31' } await sor.C('downapikey', ns1) - return UiMessage(title="create apikey", message=f'appid={ns['id']}, apikey={ns1['apikey']}, secretkey={ns['secretkey'}') + return UiMessage(title="create apikey", message=f"appid={ns['id']}, apikey={ns1['apikey']}, secretkey={ns['secretkey']}") return UiError(title='create apikey', message='add apikey error') diff --git a/wwwroot/create_apikey.ui b/wwwroot/create_apikey.ui index 392f2c8..3cc314d 100644 --- a/wwwroot/create_apikey.ui +++ b/wwwroot/create_apikey.ui @@ -3,7 +3,7 @@ "options":{ "title":"创建用户apikey", "dscription":"下位系统要免密登录本系统,需要设置apikey和secretkey", - "field":[ + "fields":[ { "name":"appname", "label":"应用名", @@ -25,7 +25,7 @@ "binds":[ { "wid":"self", - "evnet":"submit", + "event":"submit", "actiontype":"urlwidget", "target":"self", "options":{ From 045eea4cd6634bf62b48f74ca14e8b05c5b2160d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 31 Jul 2025 17:46:48 +0800 Subject: [PATCH 4/5] bugfix --- json/downapp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/downapp.json b/json/downapp.json index 8c54d55..a1e78bf 100644 --- a/json/downapp.json +++ b/json/downapp.json @@ -52,7 +52,7 @@ "archor":"cr" }, "options":{ - "url":"{{entire_url('/dapi/copy_apikey.ui')}}" + "url":"{{entire_url('/dapi/copy_apikey.dspy')}}" } } ] From d2d62acc26f3c87cbde27909be3bc1ffa3988771 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 31 Jul 2025 18:38:38 +0800 Subject: [PATCH 5/5] bugfix --- json/downapp.json | 4 ++-- wwwroot/copy_apikey.dspy | 43 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/json/downapp.json b/json/downapp.json index a1e78bf..94d98d5 100644 --- a/json/downapp.json +++ b/json/downapp.json @@ -4,13 +4,12 @@ "params": { "sortby":"id", "confidential_fields":["secretkey"], - "noedit":true, "browserfields": { "exclouded": ["id", "secretkey", "orgid" ], "alters": {} }, "editexclouded": [ - + "id", "secretkey", "orgid" ], "toolbar":{ "tools":[ @@ -22,6 +21,7 @@ { "name":"copy_apikey", "label":"复制apikey", + "selected_row":true, "icon":"{{entire_url('/imgs/copy.svg')}}" } ] diff --git a/wwwroot/copy_apikey.dspy b/wwwroot/copy_apikey.dspy index 867a20b..13957ba 100644 --- a/wwwroot/copy_apikey.dspy +++ b/wwwroot/copy_apikey.dspy @@ -7,7 +7,7 @@ async with db.sqlorContext(dbname) as sor: ns = { "id": params_kw.id, "orgid":orgid, - "userid":"userid + "userid":userid } sql = """select a.*, b.apikey @@ -19,5 +19,42 @@ where a.id = b.dappid recs = await sor.sqlExe(sql, ns) if len(recs): r = recs[0] - return UiMessage(title="copy apikey", message=f"appid={r.id}, apikey={r.apikey} secretkey={r.secretkey}") -return UiError(title='copy apikey', message='copy apikey error') + return { + "widgettype":"VBox", + "options":{ + "height":"100%", + "width":"100%" + }, + "subwidgets":[ + { + "widgettype":"Text", + "options":{ + "wrap":True, + "halign":"left", + "text":f"appid={r.dappid}" + } + }, + { + "widgettype":"Text", + "options":{ + "wrap":True, + "halign":"left", + "text":f"apikey={r.apikey}" + } + }, + { + "widgettype":"Text", + "options":{ + "wrap":True, + "halign":"left", + "text":f"secretkey={r.secretkey}" + } + } + ] + } +return { + "widgettype":"Text", + "options":{ + "text":'copy apikey error' + } +}