统一管理api

This commit is contained in:
SiYuan 2024-02-19 12:55:31 +08:00
parent c40b85e631
commit acf117337e
4 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,4 @@
version = '1.1.2' version = '1.0.2'
contact = '701805520' contact = '701805520'
github = 'https://github.com/LC044/WeChatMsg' github = 'https://github.com/LC044/WeChatMsg'
website = 'https://memotrace.lc044.love/' website = 'https://memotrace.lc044.love/'
@ -22,11 +22,11 @@ about = f'''
''' '''
# 数据存放文件路径 # 数据存放文件路径
INFO_FILE_PATH = './app/data/info.json' # 个人信息文件 INFO_FILE_PATH = './app/data/info.json' # 个人信息文件
DB_DIR = './app/Database/Msg' DB_DIR = './app/Database/Msg'
OUTPUT_DIR = './data/' # 输出文件夹 OUTPUT_DIR = './data/' # 输出文件夹
# 全局参数 # 全局参数
SEND_LOG_FLAG = True # 是否发送错误日志 SEND_LOG_FLAG = True # 是否发送错误日志
SERVER_API_URL = 'http://api.lc044.love' # api接口
# SERVER_API_URL = 'http://127.0.0.1:8000' # api接口

View File

@ -1,11 +1,13 @@
import json import json
import os.path import os.path
from urllib.parse import urljoin
import requests import requests
from PyQt5.QtCore import pyqtSignal, QThread from PyQt5.QtCore import pyqtSignal, QThread
from PyQt5.QtWidgets import QWidget, QMessageBox from PyQt5.QtWidgets import QWidget, QMessageBox
from app.components.QCursorGif import QCursorGif from app.components.QCursorGif import QCursorGif
from app.config import SERVER_API_URL
from app.decrypt.get_bias_addr import BiasAddr from app.decrypt.get_bias_addr import BiasAddr
from .getBiasAddrUi import Ui_Form from .getBiasAddrUi import Ui_Form
@ -98,7 +100,7 @@ class GetBiasAddrControl(QWidget, Ui_Form, QCursorGif):
) )
def upload(self, version_data): def upload(self, version_data):
url = "http://api.lc044.love/wxBiasAddr" url = urljoin(SERVER_API_URL,'wxBiasAddr')
try: try:
requests.post(url, json=version_data) requests.post(url, json=version_data)
print('版本信息上传成功') print('版本信息上传成功')

View File

@ -2,6 +2,7 @@ import json
import os.path import os.path
import sys import sys
import traceback import traceback
from urllib.parse import urljoin
import requests import requests
from PyQt5.QtCore import pyqtSignal, QThread, QUrl from PyQt5.QtCore import pyqtSignal, QThread, QUrl
@ -11,7 +12,7 @@ from PyQt5.QtWidgets import QWidget, QMessageBox, QFileDialog
from app.DataBase import msg_db, misc_db, close_db from app.DataBase import msg_db, misc_db, close_db
from app.DataBase.merge import merge_databases, merge_MediaMSG_databases from app.DataBase.merge import merge_databases, merge_MediaMSG_databases
from app.components.QCursorGif import QCursorGif from app.components.QCursorGif import QCursorGif
from app.config import INFO_FILE_PATH, DB_DIR from app.config import INFO_FILE_PATH, DB_DIR, SERVER_API_URL
from app.decrypt import get_wx_info, decrypt from app.decrypt import get_wx_info, decrypt
from app.log import logger from app.log import logger
from app.util import path from app.util import path
@ -296,7 +297,7 @@ class MyThread(QThread):
pass pass
def get_bias_add(self, version): def get_bias_add(self, version):
url = "http://api.lc044.love/wxBiasAddr" url = urljoin(SERVER_API_URL,'wxBiasAddr')
data = { data = {
'version': version 'version': version
} }

View File

@ -1,6 +1,7 @@
import os import os
import sys import sys
import time import time
from urllib.parse import urljoin
import requests import requests
from flask import Flask, render_template, send_file, jsonify, make_response, request from flask import Flask, render_template, send_file, jsonify, make_response, request
@ -9,6 +10,7 @@ from pyecharts.charts import Bar
from app.DataBase import msg_db, micro_msg_db from app.DataBase import msg_db, micro_msg_db
from app.DataBase.hard_link import decodeExtraBuf from app.DataBase.hard_link import decodeExtraBuf
from app.analysis import analysis from app.analysis import analysis
from app.config import SERVER_API_URL
from app.person import Contact, Me, ContactDefault from app.person import Contact, Me, ContactDefault
from app.util.emoji import get_most_emoji from app.util.emoji import get_most_emoji
from app.util.region_conversion import conversion_region_to_chinese from app.util.region_conversion import conversion_region_to_chinese
@ -22,7 +24,9 @@ start_time = '2023-1-01 00:00:00'
end_time = '2023-12-31 23:59:59' end_time = '2023-12-31 23:59:59'
time_range = (start_time, end_time) time_range = (start_time, end_time)
html: str = '' html: str = ''
api_url = 'http://api.lc044.love/upload'
api_url = urljoin(SERVER_API_URL,'upload')
def get_contact(wxid) -> ContactDefault | Contact: def get_contact(wxid) -> ContactDefault | Contact: