mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-05 19:17:56 -05:00
refac
This commit is contained in:
1 parent
b01fe7fae2
commit
6f2fc7bc7a
66 files changed
+2206
-2737
No files matched your search
@@ -2,7 +2,7 @@ from fastapi import HTTPException
|
||||
from open_webui.utils.auth import create_token, decode_token, get_verified_user_by_id
|
||||
|
||||
|
||||
def browser_ticket(server_id, user_id, chat_id, session, headers=None, cookies=None):
|
||||
def create_browser_token(server_id, user_id, chat_id, session, headers=None, cookies=None, *, resource='browser'):
|
||||
from open_webui.utils.oauth import encrypt_data
|
||||
|
||||
relay = encrypt_data(
|
||||
@@ -18,14 +18,16 @@ def browser_ticket(server_id, user_id, chat_id, session, headers=None, cookies=N
|
||||
'user': user_id,
|
||||
'chat': chat_id,
|
||||
'session': session['id'],
|
||||
'resource': resource,
|
||||
'model': (headers or {}).get('X-Terminal-Model-Id'),
|
||||
'capability': session['token'],
|
||||
'relay': relay,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
async def browser_access(server_id, sid, ticket):
|
||||
data = decode_token(ticket)
|
||||
async def browser_access(server_id, sid, browser_token):
|
||||
data = decode_token(browser_token)
|
||||
if (
|
||||
not data
|
||||
or data.get('purpose') != 'terminal-browser'
|
||||
|
||||
Reference in new issue
Block a user