Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
V
vidai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
vidai
Commits
a4cd7ebe
Commit
a4cd7ebe
authored
Oct 06, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further fix get_user_api_tokens for missing columns
parent
cb5d5078
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
database.py
vidai/database.py
+23
-7
No files found.
vidai/database.py
View file @
a4cd7ebe
...
@@ -1161,13 +1161,27 @@ def get_user_api_tokens(user_id: int) -> List[Dict[str, Any]]:
...
@@ -1161,13 +1161,27 @@ def get_user_api_tokens(user_id: int) -> List[Dict[str, Any]]:
FROM user_api_tokens
FROM user_api_tokens
WHERE user_id = ? ORDER BY created_at DESC
WHERE user_id = ? ORDER BY created_at DESC
'''
,
(
user_id
,))
'''
,
(
user_id
,))
except
sqlite3
.
OperationalError
:
except
sqlite3
.
OperationalError
as
e
:
# Fallback if 'name' column doesn't exist
if
'name'
in
str
(
e
):
cursor
.
execute
(
'''
# Fallback if 'name' column doesn't exist
SELECT id, created_at, last_used, active
try
:
FROM user_api_tokens
cursor
.
execute
(
'''
WHERE user_id = ? ORDER BY created_at DESC
SELECT id, created_at, last_used, active
'''
,
(
user_id
,))
FROM user_api_tokens
WHERE user_id = ? ORDER BY created_at DESC
'''
,
(
user_id
,))
except
sqlite3
.
OperationalError
as
e2
:
if
'last_used'
in
str
(
e2
):
# Fallback if 'last_used' also doesn't exist
cursor
.
execute
(
'''
SELECT id, created_at, active
FROM user_api_tokens
WHERE user_id = ? ORDER BY created_at DESC
'''
,
(
user_id
,))
else
:
raise
e2
else
:
raise
e
rows
=
cursor
.
fetchall
()
rows
=
cursor
.
fetchall
()
conn
.
close
()
conn
.
close
()
tokens
=
[]
tokens
=
[]
...
@@ -1175,6 +1189,8 @@ def get_user_api_tokens(user_id: int) -> List[Dict[str, Any]]:
...
@@ -1175,6 +1189,8 @@ def get_user_api_tokens(user_id: int) -> List[Dict[str, Any]]:
token_dict
=
dict
(
row
)
token_dict
=
dict
(
row
)
if
'name'
not
in
token_dict
:
if
'name'
not
in
token_dict
:
token_dict
[
'name'
]
=
'Unnamed Token'
# Default name
token_dict
[
'name'
]
=
'Unnamed Token'
# Default name
if
'last_used'
not
in
token_dict
:
token_dict
[
'last_used'
]
=
None
tokens
.
append
(
token_dict
)
tokens
.
append
(
token_dict
)
return
tokens
return
tokens
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment