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
Hide 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
{% extends 'base.html' %}
{% block title %}Configuration - VidAI{% endblock %}
{% block head %}
<style>
.config-container
{
max-width
:
1200px
;
margin
:
2rem
auto
;
padding
:
0
2rem
;
}
.config-section
{
background
:
white
;
padding
:
2rem
;
border-radius
:
12px
;
box-shadow
:
0
4px
12px
rgba
(
0
,
0
,
0
,
0.1
);
margin-bottom
:
2rem
;
}
.section-title
{
color
:
#333
;
margin-bottom
:
1.5rem
;
font-size
:
1.5rem
;
font-weight
:
600
;
border-bottom
:
2px
solid
#667eea
;
padding-bottom
:
0.5rem
;
}
.form-row
{
display
:
flex
;
gap
:
1rem
;
margin-bottom
:
1rem
;
}
.form-row
.form-group
{
flex
:
1
;
}
.form-group
{
margin-bottom
:
1.5rem
;
}
.form-group
label
{
display
:
block
;
margin-bottom
:
0.5rem
;
color
:
#374151
;
font-weight
:
500
;
}
.form-group
input
,
.form-group
select
{
width
:
100%
;
padding
:
0.75rem
;
border
:
2px
solid
#e5e7eb
;
border-radius
:
8px
;
font-size
:
1rem
;
}
.form-group
input
:focus
,
.form-group
select
:focus
{
outline
:
none
;
border-color
:
#667eea
;
}
.form-group
input
[
type
=
"checkbox"
]
{
width
:
auto
;
margin-right
:
0.5rem
;
}
.btn-submit
{
padding
:
0.75rem
2rem
;
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 %}
<div
class=
"config-container"
>
<div
class=
"config-section"
>
<h2
class=
"section-title"
>
Registration Settings
</h2>
<form
method=
"post"
>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"allow_registration"
>
<input
type=
"checkbox"
id=
"allow_registration"
name=
"allow_registration"
{%
if
current_config
.
allow_registration
%}
checked
{%
endif
%}
>
Allow User Registration
</label>
</div>
<div
class=
"form-group"
>
<label
for=
"default_user_tokens"
>
Default User Tokens
</label>
<input
type=
"number"
id=
"default_user_tokens"
name=
"default_user_tokens"
value=
"{{ current_config.default_user_tokens }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"token_price_usd"
>
Token Price (USD)
</label>
<input
type=
"number"
step=
"0.01"
id=
"token_price_usd"
name=
"token_price_usd"
value=
"{{ current_config.token_price_usd }}"
>
</div>
</div>
</div>
<div
class=
"config-section"
>
<h2
class=
"section-title"
>
Email Settings
</h2>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"smtp_server"
>
SMTP Server
</label>
<input
type=
"text"
id=
"smtp_server"
name=
"smtp_server"
value=
"{{ current_config.smtp_server }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"smtp_port"
>
SMTP Port
</label>
<input
type=
"number"
id=
"smtp_port"
name=
"smtp_port"
value=
"{{ current_config.smtp_port }}"
>
</div>
</div>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"smtp_username"
>
SMTP Username
</label>
<input
type=
"text"
id=
"smtp_username"
name=
"smtp_username"
value=
"{{ current_config.smtp_username }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"smtp_password"
>
SMTP Password
</label>
<input
type=
"password"
id=
"smtp_password"
name=
"smtp_password"
value=
"{{ current_config.smtp_password }}"
>
</div>
</div>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"smtp_use_tls"
>
<input
type=
"checkbox"
id=
"smtp_use_tls"
name=
"smtp_use_tls"
{%
if
current_config
.
smtp_use_tls
%}
checked
{%
endif
%}
>
Use TLS
</label>
</div>
<div
class=
"form-group"
>
<label
for=
"smtp_use_ssl"
>
<input
type=
"checkbox"
id=
"smtp_use_ssl"
name=
"smtp_use_ssl"
{%
if
current_config
.
smtp_use_ssl
%}
checked
{%
endif
%}
>
Use SSL
</label>
</div>
</div>
</div>
<div
class=
"config-section"
>
<h2
class=
"section-title"
>
Payment Settings
</h2>
<h3>
Stripe
</h3>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"stripe_publishable_key"
>
Stripe Publishable Key
</label>
<input
type=
"text"
id=
"stripe_publishable_key"
name=
"stripe_publishable_key"
value=
"{{ current_config.stripe_publishable_key }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"stripe_secret_key"
>
Stripe Secret Key
</label>
<input
type=
"password"
id=
"stripe_secret_key"
name=
"stripe_secret_key"
value=
"{{ current_config.stripe_secret_key }}"
>
</div>
</div>
<h3>
PayPal
</h3>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"paypal_client_id"
>
PayPal Client ID
</label>
<input
type=
"text"
id=
"paypal_client_id"
name=
"paypal_client_id"
value=
"{{ current_config.paypal_client_id }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"paypal_client_secret"
>
PayPal Client Secret
</label>
<input
type=
"password"
id=
"paypal_client_secret"
name=
"paypal_client_secret"
value=
"{{ current_config.paypal_client_secret }}"
>
</div>
</div>
<h3>
Cryptocurrency
</h3>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"btc_payment_address"
>
BTC Payment Address
</label>
<input
type=
"text"
id=
"btc_payment_address"
name=
"btc_payment_address"
value=
"{{ current_config.btc_payment_address }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"eth_payment_address"
>
ETH Payment Address
</label>
<input
type=
"text"
id=
"eth_payment_address"
name=
"eth_payment_address"
value=
"{{ current_config.eth_payment_address }}"
>
</div>
</div>
</div>
<div
class=
"config-section"
>
<h2
class=
"section-title"
>
General Settings
</h2>
<div
class=
"form-group"
>
<label
for=
"base_url"
>
Base URL
</label>
<input
type=
"text"
id=
"base_url"
name=
"base_url"
value=
"{{ current_config.base_url }}"
>
</div>
</div>
<div
class=
"config-section"
>
<h2
class=
"section-title"
>
Database Settings
</h2>
<div
class=
"form-group"
>
<label
for=
"db_type"
>
Database Type
</label>
<select
id=
"db_type"
name=
"db_type"
>
<option
value=
"sqlite"
{%
if
current_config
.
db_type =
=
'
sqlite
'
%}
selected
{%
endif
%}
>
SQLite
</option>
<option
value=
"mysql"
{%
if
current_config
.
db_type =
=
'
mysql
'
%}
selected
{%
endif
%}
>
MySQL
</option>
</select>
</div>
<div
id=
"sqlite_settings"
{%
if
current_config
.
db_type
!=
'
sqlite
'
%}
style=
"display: none;"
{%
endif
%}
>
<div
class=
"form-group"
>
<label
for=
"db_sqlite_path"
>
SQLite Database Path
</label>
<input
type=
"text"
id=
"db_sqlite_path"
name=
"db_sqlite_path"
value=
"{{ current_config.db_sqlite_path }}"
>
</div>
</div>
<div
id=
"mysql_settings"
{%
if
current_config
.
db_type
!=
'
mysql
'
%}
style=
"display: none;"
{%
endif
%}
>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"db_mysql_host"
>
MySQL Host
</label>
<input
type=
"text"
id=
"db_mysql_host"
name=
"db_mysql_host"
value=
"{{ current_config.db_mysql_host }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"db_mysql_port"
>
MySQL Port
</label>
<input
type=
"number"
id=
"db_mysql_port"
name=
"db_mysql_port"
value=
"{{ current_config.db_mysql_port }}"
>
</div>
</div>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"db_mysql_user"
>
MySQL User
</label>
<input
type=
"text"
id=
"db_mysql_user"
name=
"db_mysql_user"
value=
"{{ current_config.db_mysql_user }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"db_mysql_password"
>
MySQL Password
</label>
<input
type=
"password"
id=
"db_mysql_password"
name=
"db_mysql_password"
value=
"{{ current_config.db_mysql_password }}"
>
</div>
</div>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"db_mysql_database"
>
MySQL Database
</label>
<input
type=
"text"
id=
"db_mysql_database"
name=
"db_mysql_database"
value=
"{{ current_config.db_mysql_database }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"db_mysql_charset"
>
MySQL Charset
</label>
<input
type=
"text"
id=
"db_mysql_charset"
name=
"db_mysql_charset"
value=
"{{ current_config.db_mysql_charset }}"
>
</div>
</div>
</div>
</div>
<div
class=
"config-section"
>
<h2
class=
"section-title"
>
Network Settings
</h2>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"web_host"
>
Web Host
</label>
<input
type=
"text"
id=
"web_host"
name=
"web_host"
value=
"{{ current_config.web_host }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"web_port"
>
Web Port
</label>
<input
type=
"number"
id=
"web_port"
name=
"web_port"
value=
"{{ current_config.web_port }}"
>
</div>
</div>
<div
class=
"form-row"
>
<div
class=
"form-group"
>
<label
for=
"backend_host"
>
Backend Host
</label>
<input
type=
"text"
id=
"backend_host"
name=
"backend_host"
value=
"{{ current_config.backend_host }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"backend_web_port"
>
Backend Web Port
</label>
<input
type=
"number"
id=
"backend_web_port"
name=
"backend_web_port"
value=
"{{ current_config.backend_web_port }}"
>
</div>
<div
class=
"form-group"
>
<label
for=
"backend_worker_port"
>
Backend Worker Port
</label>
<input
type=
"number"
id=
"backend_worker_port"
name=
"backend_worker_port"
value=
"{{ current_config.backend_worker_port }}"
>
</div>
</div>
<button
type=
"submit"
class=
"btn-submit"
>
Save Configuration
</button>
</form>
</div>
</div>
<script>
document
.
getElementById
(
'db_type'
).
addEventListener
(
'change'
,
function
()
{
const
dbType
=
this
.
value
;
document
.
getElementById
(
'sqlite_settings'
).
style
.
display
=
dbType
===
'sqlite'
?
'block'
:
'none'
;
document
.
getElementById
(
'mysql_settings'
).
style
.
display
=
dbType
===
'mysql'
?
'block'
:
'none'
;
});
</script>
{% endblock %}
\ No newline at end of file
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