|
@@ -14,6 +14,7 @@ import re
|
|
from threading import Thread
|
|
from threading import Thread
|
|
from api.utils import shell_execute, docker, const
|
|
from api.utils import shell_execute, docker, const
|
|
from api.model.app import App
|
|
from api.model.app import App
|
|
|
|
+from api.service import db
|
|
from api.model.response import Response
|
|
from api.model.response import Response
|
|
from api.model.config import Config
|
|
from api.model.config import Config
|
|
from api.model.status_reason import StatusReason
|
|
from api.model.status_reason import StatusReason
|
|
@@ -44,6 +45,8 @@ scheduler = BackgroundScheduler()
|
|
scheduler.add_job(auto_update, 'cron', hour=1)
|
|
scheduler.add_job(auto_update, 'cron', hour=1)
|
|
scheduler.start()
|
|
scheduler.start()
|
|
|
|
|
|
|
|
+nginx_token = None
|
|
|
|
+
|
|
# 获取github文件内容
|
|
# 获取github文件内容
|
|
def get_github_content(repo, path):
|
|
def get_github_content(repo, path):
|
|
url = 'https://websoft9.github.io/{repo}/{path}'
|
|
url = 'https://websoft9.github.io/{repo}/{path}'
|
|
@@ -1108,10 +1111,10 @@ def check_real_domain(domain):
|
|
|
|
|
|
|
|
|
|
def get_token():
|
|
def get_token():
|
|
- url = 'http://172.17.0.1:9092/api/tokens'
|
|
|
|
|
|
+ url = const.NGINX_URL+"/api/tokens"
|
|
headers = {'Content-type': 'application/json'}
|
|
headers = {'Content-type': 'application/json'}
|
|
- cmd = "cat /usr/share/cockpit/myapps/config.json | jq -r '.NGINXPROXYMANAGER.NGINXPROXYMANAGER_PASSWORD'"
|
|
|
|
- password = shell_execute.execute_command_output_all(cmd)["result"].rstrip('\n')
|
|
|
|
|
|
+ password = db.AppSearchUsers("nginx").json()["password"]
|
|
|
|
+
|
|
myLogger.info_logger(password)
|
|
myLogger.info_logger(password)
|
|
param = {
|
|
param = {
|
|
"identity": "help@websoft9.com",
|
|
"identity": "help@websoft9.com",
|
|
@@ -1120,6 +1123,8 @@ def get_token():
|
|
}
|
|
}
|
|
response = requests.post(url, data=json.dumps(param), headers=headers)
|
|
response = requests.post(url, data=json.dumps(param), headers=headers)
|
|
|
|
|
|
|
|
+ nginx_token = response.json()
|
|
|
|
+ myLogger.info_logger(nginx_token)
|
|
token = "Bearer " + response.json()["token"]
|
|
token = "Bearer " + response.json()["token"]
|
|
return token
|
|
return token
|
|
|
|
|