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
bc318365
Commit
bc318365
authored
Oct 07, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move /config to /admin/config and rewrite to show all database configurations grouped by type
parent
9d7fff40
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
320 additions
and
73 deletions
+320
-73
config.html
templates/admin/config.html
+215
-0
base.html
templates/base.html
+1
-1
config.html
templates/config.html
+0
-54
admin.py
vidai/admin.py
+104
-0
web.py
vidai/web.py
+0
-18
No files found.
templates/admin/config.html
0 → 100644
View file @
bc318365
This diff is collapsed.
Click to expand it.
templates/base.html
View file @
bc318365
...
...
@@ -95,7 +95,7 @@
<a
href=
"/admin/api"
>
Admin API Documentation
</a>
<a
href=
"/admin/users"
>
Users
</a>
<a
href=
"/api_tokens"
>
Linked Apps
</a>
<a
href=
"/config"
>
Configurations
</a>
<a
href=
"/
admin/
config"
>
Configurations
</a>
{% endif %}
<a
href=
"/logout"
>
Logout
</a>
</div>
...
...
templates/config.html
deleted
100644 → 0
View file @
9d7fff40
{% extends "base.html" %}
{% block title %}Configuration - VidAI{% endblock %}
{% block head %}
<style>
.header
{
background
:
white
;
padding
:
1rem
2rem
;
box-shadow
:
0
1px
3px
rgba
(
0
,
0
,
0
,
0.1
);
}
.header-content
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
max-width
:
1200px
;
margin
:
0
auto
;
}
.logo
{
font-size
:
1.5rem
;
font-weight
:
700
;
color
:
#667eea
;
}
.nav
{
display
:
flex
;
gap
:
2rem
;
}
.nav
a
{
text-decoration
:
none
;
color
:
#64748b
;
font-weight
:
500
;
}
.nav
a
.active
{
color
:
#667eea
;
}
.config-container
{
max-width
:
800px
;
margin
:
2rem
auto
;
background
:
white
;
padding
:
2rem
;
border-radius
:
12px
;
box-shadow
:
0
4px
12px
rgba
(
0
,
0
,
0
,
0.1
);
}
.config-title
{
color
:
#333
;
text-align
:
center
;
margin-bottom
:
2rem
;
font-size
:
2rem
;
font-weight
:
600
;
}
.config-form
{
margin-bottom
:
2rem
;
}
.form-group
{
margin-bottom
:
1.5rem
;
}
.form-group
label
{
display
:
block
;
margin-bottom
:
0.5rem
;
color
:
#374151
;
font-weight
:
500
;
}
.form-group
select
{
width
:
100%
;
padding
:
0.75rem
;
border
:
2px
solid
#e5e7eb
;
border-radius
:
8px
;
font-size
:
1rem
;
}
.form-group
select
:focus
{
outline
:
none
;
border-color
:
#667eea
;
}
.btn-submit
{
width
:
100%
;
padding
:
0.75rem
;
background
:
#667eea
;
color
:
white
;
border
:
none
;
border-radius
:
8px
;
font-size
:
1rem
;
font-weight
:
600
;
cursor
:
pointer
;
}
.btn-submit
:hover
{
background
:
#5a67d8
;
}
</style>
{% endblock %}
{% block content %}
<header
class=
"header"
>
<div
class=
"header-content"
>
<div
class=
"logo"
>
VidAI
</div>
<nav
class=
"nav"
>
<a
href=
"/"
>
Home
</a>
<a
href=
"/config"
class=
"active"
>
Configuration
</a>
</nav>
</div>
</header>
<div
class=
"config-container"
>
<h1
class=
"config-title"
>
Configuration
</h1>
<form
method=
"post"
class=
"config-form"
>
<div
class=
"form-group"
>
<label
for=
"default_model"
>
Default AI Model
</label>
<input
type=
"text"
id=
"default_model"
name=
"default_model"
value=
"Qwen/Qwen2.5-VL-7B-Instruct"
placeholder=
"Model path or HuggingFace ID"
>
</div>
<div
class=
"form-group"
>
<label
for=
"theme"
>
Theme Preference
</label>
<select
id=
"theme"
name=
"theme"
>
<option
value=
"light"
selected
>
Light
</option>
<option
value=
"dark"
>
Dark
</option>
</select>
</div>
<button
type=
"submit"
class=
"btn-submit"
>
Save Configuration
</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
vidai/admin.py
View file @
bc318365
...
...
@@ -274,6 +274,110 @@ def delete_cluster_token(token_id):
flash
(
'Failed to delete token.'
,
'error'
)
return
redirect
(
url_for
(
'admin.cluster_tokens'
))
@
admin_bp
.
route
(
'/config'
,
methods
=
[
'GET'
,
'POST'
])
@
admin_required
def
config
():
"""Admin configuration page."""
user
=
get_current_user_session
()
if
request
.
method
==
'POST'
:
# Handle form submission for all database configs
from
.config
import
(
set_allow_registration
,
set_default_user_tokens
,
set_token_price
,
set_smtp_server
,
set_smtp_port
,
set_smtp_credentials
,
set_smtp_security
,
set_stripe_keys
,
set_paypal_credentials
,
set_crypto_addresses
,
set_base_url
,
set_db_type
,
set_db_sqlite_path
,
set_db_mysql_config
,
set_web_host
,
set_web_port
,
set_backend_host
,
set_backend_web_port
,
set_backend_worker_port
)
# Registration
allow_registration
=
request
.
form
.
get
(
'allow_registration'
)
==
'on'
set_allow_registration
(
allow_registration
)
default_user_tokens
=
int
(
request
.
form
.
get
(
'default_user_tokens'
,
'100'
))
set_default_user_tokens
(
default_user_tokens
)
token_price_usd
=
float
(
request
.
form
.
get
(
'token_price_usd'
,
'0.10'
))
set_token_price
(
token_price_usd
)
# Email
smtp_server
=
request
.
form
.
get
(
'smtp_server'
,
'smtp.gmail.com'
)
set_smtp_server
(
smtp_server
)
smtp_port
=
int
(
request
.
form
.
get
(
'smtp_port'
,
'587'
))
set_smtp_port
(
smtp_port
)
smtp_username
=
request
.
form
.
get
(
'smtp_username'
,
''
)
smtp_password
=
request
.
form
.
get
(
'smtp_password'
,
''
)
if
smtp_username
:
set_smtp_credentials
(
smtp_username
,
smtp_password
)
smtp_use_tls
=
request
.
form
.
get
(
'smtp_use_tls'
)
==
'on'
smtp_use_ssl
=
request
.
form
.
get
(
'smtp_use_ssl'
)
==
'on'
set_smtp_security
(
smtp_use_tls
,
smtp_use_ssl
)
# Payments
stripe_publishable_key
=
request
.
form
.
get
(
'stripe_publishable_key'
,
''
)
stripe_secret_key
=
request
.
form
.
get
(
'stripe_secret_key'
,
''
)
if
stripe_publishable_key
and
stripe_secret_key
:
set_stripe_keys
(
stripe_publishable_key
,
stripe_secret_key
)
paypal_client_id
=
request
.
form
.
get
(
'paypal_client_id'
,
''
)
paypal_client_secret
=
request
.
form
.
get
(
'paypal_client_secret'
,
''
)
if
paypal_client_id
and
paypal_client_secret
:
set_paypal_credentials
(
paypal_client_id
,
paypal_client_secret
)
btc_address
=
request
.
form
.
get
(
'btc_payment_address'
,
''
)
eth_address
=
request
.
form
.
get
(
'eth_payment_address'
,
''
)
set_crypto_addresses
(
btc_address
,
eth_address
)
# Base URL
base_url
=
request
.
form
.
get
(
'base_url'
,
'http://localhost:5000'
)
set_base_url
(
base_url
)
# Database
db_type
=
request
.
form
.
get
(
'db_type'
,
'sqlite'
)
set_db_type
(
db_type
)
if
db_type
==
'sqlite'
:
db_sqlite_path
=
request
.
form
.
get
(
'db_sqlite_path'
,
'vidai.db'
)
set_db_sqlite_path
(
db_sqlite_path
)
else
:
db_mysql_host
=
request
.
form
.
get
(
'db_mysql_host'
,
'localhost'
)
db_mysql_port
=
int
(
request
.
form
.
get
(
'db_mysql_port'
,
'3306'
))
db_mysql_user
=
request
.
form
.
get
(
'db_mysql_user'
,
'vidai'
)
db_mysql_password
=
request
.
form
.
get
(
'db_mysql_password'
,
''
)
db_mysql_database
=
request
.
form
.
get
(
'db_mysql_database'
,
'vidai'
)
db_mysql_charset
=
request
.
form
.
get
(
'db_mysql_charset'
,
'utf8mb4'
)
set_db_mysql_config
(
db_mysql_host
,
db_mysql_port
,
db_mysql_user
,
db_mysql_password
,
db_mysql_database
,
db_mysql_charset
)
# Network
web_host
=
request
.
form
.
get
(
'web_host'
,
'0.0.0.0'
)
set_web_host
(
web_host
)
web_port
=
int
(
request
.
form
.
get
(
'web_port'
,
'5000'
))
set_web_port
(
web_port
)
backend_host
=
request
.
form
.
get
(
'backend_host'
,
'localhost'
)
set_backend_host
(
backend_host
)
backend_web_port
=
int
(
request
.
form
.
get
(
'backend_web_port'
,
'5001'
))
set_backend_web_port
(
backend_web_port
)
backend_worker_port
=
int
(
request
.
form
.
get
(
'backend_worker_port'
,
'5002'
))
set_backend_worker_port
(
backend_worker_port
)
flash
(
'Configuration updated successfully!'
,
'success'
)
# Get all current settings
from
.config
import
get_all_settings
current_config
=
get_all_settings
()
return
render_template
(
'admin/config.html'
,
user
=
user
,
current_config
=
current_config
,
active_page
=
'config'
)
@
admin_bp
.
route
(
'/settings'
)
@
admin_required
def
settings
():
...
...
vidai/web.py
View file @
bc318365
...
...
@@ -266,24 +266,6 @@ def analyze():
active_page
=
'analyze'
)
@
app
.
route
(
'/config'
,
methods
=
[
'GET'
,
'POST'
])
def
config
():
if
request
.
method
==
'POST'
:
from
.config
import
set_default_model
,
set_default_model_type
default_model
=
request
.
form
.
get
(
'default_model'
,
'Qwen/Qwen2.5-VL-7B-Instruct'
)
theme
=
request
.
form
.
get
(
'theme'
,
'light'
)
set_default_model
(
default_model
)
# For theme, perhaps store it somewhere, but for now, just flash
flash
(
'Configuration updated successfully!'
,
'success'
)
# Get current config
from
.config
import
get_default_model
current_config
=
{
'default_model'
:
get_default_model
(),
'theme'
:
'light'
# Default
}
return
render_template
(
'config.html'
,
current_config
=
current_config
,
available_backends
=
[],
active_page
=
'config'
,
user
=
None
)
@
app
.
route
(
'/history'
)
@
login_required
...
...
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