configs
This commit is contained in:
parent
da045a7c02
commit
f20f9528aa
9 changed files with 37 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
.venv
|
||||
configs/config/params_spectralvpn.conf
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
from fastapi import FastAPI, HTTPException, Query, status
|
||||
from pydantic import BaseModel, EmailStr
|
||||
import configparser
|
||||
import utils
|
||||
|
||||
app = FastAPI()
|
||||
args = ["", "", "", "", 0, "", ""]
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('../configs/config/params.conf', encoding='utf-8')
|
||||
args = [config["api"]["path"], config["api"]["host"], config["api"]["username"], config["api"]["password"], config.getint("api", "inbaund_id"), config["api"]["inbaund_url"]]
|
||||
|
||||
class RegisterBody(BaseModel) :
|
||||
email : EmailStr
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import requests
|
|||
import random
|
||||
|
||||
class API :
|
||||
def __init__(self, path: str, host: str, username: str, passwd: str, inbaund_id: int, inbaund_url: str, inbaund_port: str) :
|
||||
def __init__(self, path: str, host: str, username: str, passwd: str, inbaund_id: int, inbaund_url: str) :
|
||||
self.con = sqlite3.connect(path)
|
||||
self.cur = self.con.cursor()
|
||||
self.cur.execute("""
|
||||
|
|
@ -38,7 +38,6 @@ class API :
|
|||
|
||||
self.inbaund_id = inbaund_id
|
||||
self.inbaund_url = inbaund_url
|
||||
self.inbaund_port = inbaund_port
|
||||
|
||||
def read_table(self, sql_command: str, params=None) -> dict :
|
||||
if params == None :
|
||||
|
|
@ -148,7 +147,7 @@ class API :
|
|||
if inbaund == None :
|
||||
raise TypeError
|
||||
|
||||
url = f"vless://{uid}@{self.inbaund_url}:{self.inbaund_port}?security=reality&pbk={pbk}&fp=random&sni={sni}&sid={suid}&spx=%2F&flow=xtls-rprx-vision#SpectralVPN-{url_name}"
|
||||
url = f"vless://{uid}@{self.inbaund_url}?security=reality&pbk={pbk}&fp=random&sni={sni}&sid={suid}&spx=%2F&flow=xtls-rprx-vision#SpectralVPN-{url_name}"
|
||||
|
||||
urls.append(url_name)
|
||||
|
||||
|
|
@ -201,7 +200,7 @@ class API :
|
|||
if client == None :
|
||||
raise TypeError
|
||||
uid = client["id"]
|
||||
url = f"vless://{uid}@{self.inbaund_url}:{self.inbaund_port}?security=reality&pbk={pbk}&fp=random&sni={sni}&sid={suid}&spx=%2F&flow=xtls-rprx-vision#SpectralVPN-{url_name}"
|
||||
url = f"vless://{uid}@{self.inbaund_url}?security=reality&pbk={pbk}&fp=random&sni={sni}&sid={suid}&spx=%2F&flow=xtls-rprx-vision#SpectralVPN-{url_name}"
|
||||
|
||||
return {"code": 0, "data": {"id": int(data["id"]["0"]), "email": email, "urls": urls, "url": url}}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const port = 8000;
|
||||
const API_URL = "https://spectralvpn.ru:${port}";
|
||||
const API_URL = "http://localhost:${port}";
|
||||
|
||||
async function sha256(text) {
|
||||
const encoder = new TextEncoder();
|
||||
|
|
|
|||
7
configs/config/params.conf
Normal file
7
configs/config/params.conf
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[api]
|
||||
path = spectralvpn.db
|
||||
host =
|
||||
username =
|
||||
password =
|
||||
inbaund_id = 0
|
||||
inbaund_url =
|
||||
7
configs/nginx/spectralvpn.ru.nginx
Normal file
7
configs/nginx/spectralvpn.ru.nginx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
https {
|
||||
listen 443;
|
||||
listen [::]:443;
|
||||
server_name spectralvpn.ru;
|
||||
|
||||
root /var/www/html/spectralvpn.ru;
|
||||
}
|
||||
7
configs/nginx/spectralvpn.ru_http.nginx
Normal file
7
configs/nginx/spectralvpn.ru_http.nginx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
http {
|
||||
listen 80 spectralvpn.ru;
|
||||
listen [::]:80 spectralvpn.ru;
|
||||
|
||||
root /var/www/html/spectralvpn.ru;
|
||||
Pages/index.html;
|
||||
}
|
||||
3
configs/nginx/spectralvpn_api.nginx
Normal file
3
configs/nginx/spectralvpn_api.nginx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
server {
|
||||
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
fastapi[all]
|
||||
pandas
|
||||
configparser
|
||||
Loading…
Add table
Add a link
Reference in a new issue