Skip to content

Commit

Permalink
update auth (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
doombeaker authored Jul 29, 2024
1 parent da0cc72 commit 6e741c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def set_api_key(request):
try:
if api_key:
response = web.Response(text="ok")
response.set_cookie("api_key", api_key)
response.set_cookie("api_key", api_key, max_age=30 * 24 * 60 * 60)
API_KEY = api_key
return response
else:
Expand Down Expand Up @@ -126,7 +126,6 @@ async def get_api_key(request):
if api_key:
API_KEY = api_key
response = web.Response(text="ok")
response.set_cookie("api_key", api_key)
return response
else:
return web.Response(
Expand Down
12 changes: 10 additions & 2 deletions js/set_api_key.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ app.registerExtension({
if (response.status === 200) {
console.log("get SiliconCloud api key successfuly")
} else {
alert(`Use node 'Set SiliconCloud API Key' first,
alert(`Please click "BizyAir Key" button to set API key first,
you can get your key from cloud.siliconflow.cn,
or you can only use nodes locally.`);
const text = await response.text();
Expand All @@ -80,8 +80,10 @@ or you can only use nodes locally.`);
if (response.status === 200) {
console.log("set SiliconCloud api key successfuly")
} else {
alert("Use node 'Set SiliconCloud API Key' first, you can get your key from cloud.siliconflow.cn")
const text = await response.text();
alert(`Please click "BizyAir Key" button to set API key first,
you can get your key from cloud.siliconflow.cn,
or you can only use nodes locally.`);
}

this.widgets[0].value = "sk-****************";
Expand All @@ -93,4 +95,10 @@ or you can only use nodes locally.`);
};
}
},

async nodeCreated(node) {
if (node.widgets[0].name === 'API_KEY' && node.widgets[0].value === 'YOUR_API_KEY') {
alert(`The Set API Key node will be deprecated, available until 2024/08/15. Please click "BizyAir Key" button to set API key instead.`);
}
}
});

0 comments on commit 6e741c8

Please sign in to comment.