mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2025-12-14 08:06:23 +08:00
[Bug fix] Update error & About bundle download
- Data for Arcaea 5.8.0 - Fix a bug that the server's database updates from an old version may meet a challenge if `recent30` table has some strange data. - Fix the issue where the bundle downloading memory cache does not clean up. - Add a config term to only change the X-Accel-Redirect prefix for bundle downloading.
This commit is contained in:
@@ -226,6 +226,8 @@ class BundleDownload:
|
|||||||
if not sql_list:
|
if not sql_list:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
self.clear_expired_token()
|
||||||
|
|
||||||
self.c_m.executemany(
|
self.c_m.executemany(
|
||||||
'''insert into bundle_download_token values (?, ?, ?, ?)''', sql_list)
|
'''insert into bundle_download_token values (?, ?, ?, ?)''', sql_list)
|
||||||
|
|
||||||
@@ -246,3 +248,7 @@ class BundleDownload:
|
|||||||
f'Too many content bundle downloads, IP: {ip}, DeviceID: {device_id}', status=429)
|
f'Too many content bundle downloads, IP: {ip}, DeviceID: {device_id}', status=429)
|
||||||
|
|
||||||
return file_path
|
return file_path
|
||||||
|
|
||||||
|
def clear_expired_token(self) -> None:
|
||||||
|
self.c_m.execute(
|
||||||
|
'''delete from bundle_download_token where time < ?''', (int(time() - Constant.BUNDLE_DOWNLOAD_TIME_GAP_LIMIT),))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Config:
|
|||||||
OLD_GAME_API_PREFIX = [] # str | list[str]
|
OLD_GAME_API_PREFIX = [] # str | list[str]
|
||||||
|
|
||||||
ALLOW_APPVERSION = [] # list[str]
|
ALLOW_APPVERSION = [] # list[str]
|
||||||
|
|
||||||
BUNDLE_STRICT_MODE = True
|
BUNDLE_STRICT_MODE = True
|
||||||
|
|
||||||
SET_LINKPLAY_SERVER_AS_SUB_PROCESS = True
|
SET_LINKPLAY_SERVER_AS_SUB_PROCESS = True
|
||||||
@@ -49,6 +49,7 @@ class Config:
|
|||||||
|
|
||||||
DOWNLOAD_USE_NGINX_X_ACCEL_REDIRECT = False
|
DOWNLOAD_USE_NGINX_X_ACCEL_REDIRECT = False
|
||||||
NGINX_X_ACCEL_REDIRECT_PREFIX = '/nginx_download/'
|
NGINX_X_ACCEL_REDIRECT_PREFIX = '/nginx_download/'
|
||||||
|
BUNDLE_NGINX_X_ACCEL_REDIRECT_PREFIX = '/nginx_bundle_download/'
|
||||||
|
|
||||||
DOWNLOAD_TIMES_LIMIT = 3000
|
DOWNLOAD_TIMES_LIMIT = 3000
|
||||||
DOWNLOAD_TIME_GAP_LIMIT = 1000
|
DOWNLOAD_TIME_GAP_LIMIT = 1000
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from .config_manager import Config
|
from .config_manager import Config
|
||||||
|
|
||||||
ARCAEA_SERVER_VERSION = 'v2.11.3.14'
|
ARCAEA_SERVER_VERSION = 'v2.11.3.15'
|
||||||
ARCAEA_DATABASE_VERSION = 'v2.11.3.13'
|
ARCAEA_DATABASE_VERSION = 'v2.11.3.15'
|
||||||
ARCAEA_LOG_DATBASE_VERSION = 'v1.1'
|
ARCAEA_LOG_DATBASE_VERSION = 'v1.1'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -450,10 +450,11 @@ class DatabaseMigrator:
|
|||||||
for j in range(30):
|
for j in range(30):
|
||||||
rating = i[1 + j * 2]
|
rating = i[1 + j * 2]
|
||||||
rating = float(rating) if rating else 0
|
rating = float(rating) if rating else 0
|
||||||
song_id_difficulty = i[2 + j * 2]
|
song_id_difficulty: str = i[2 + j * 2]
|
||||||
if song_id_difficulty:
|
if song_id_difficulty:
|
||||||
song_id = song_id_difficulty[:-1]
|
song_id = song_id_difficulty[:-1]
|
||||||
difficulty = int(song_id_difficulty[-1])
|
difficulty = song_id_difficulty[-1]
|
||||||
|
difficulty = int(difficulty) if difficulty.isdigit() else 0
|
||||||
else:
|
else:
|
||||||
song_id = ''
|
song_id = ''
|
||||||
difficulty = 0
|
difficulty = 0
|
||||||
|
|||||||
@@ -808,5 +808,23 @@
|
|||||||
],
|
],
|
||||||
"price": 700,
|
"price": 700,
|
||||||
"orig_price": 700
|
"orig_price": 700
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "groovecoaster_append_1",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"type": "pack",
|
||||||
|
"id": "groovecoaster_append_1",
|
||||||
|
"is_available": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "core",
|
||||||
|
"amount": 3,
|
||||||
|
"id": "core_generic",
|
||||||
|
"is_available": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"price": 300,
|
||||||
|
"orig_price": 300
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -1828,5 +1828,41 @@
|
|||||||
],
|
],
|
||||||
"orig_price": 100,
|
"orig_price": 100,
|
||||||
"price": 100
|
"price": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "hypervision",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"type": "single",
|
||||||
|
"id": "hypervision",
|
||||||
|
"is_available": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "core",
|
||||||
|
"amount": 1,
|
||||||
|
"id": "core_generic",
|
||||||
|
"is_available": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"orig_price": 100,
|
||||||
|
"price": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stargateextreme",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"type": "single",
|
||||||
|
"id": "stargateextreme",
|
||||||
|
"is_available": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "core",
|
||||||
|
"amount": 1,
|
||||||
|
"id": "core_generic",
|
||||||
|
"is_available": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"orig_price": 100,
|
||||||
|
"price": 100
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -111,7 +111,7 @@ def bundle_download(token: str):
|
|||||||
# nginx X-Accel-Redirect
|
# nginx X-Accel-Redirect
|
||||||
response = make_response()
|
response = make_response()
|
||||||
response.headers['Content-Type'] = 'application/octet-stream'
|
response.headers['Content-Type'] = 'application/octet-stream'
|
||||||
response.headers['X-Accel-Redirect'] = Config.NGINX_X_ACCEL_REDIRECT_PREFIX + file_path
|
response.headers['X-Accel-Redirect'] = Config.BUNDLE_NGINX_X_ACCEL_REDIRECT_PREFIX + file_path
|
||||||
return response
|
return response
|
||||||
return send_from_directory(Constant.CONTENT_BUNDLE_FOLDER_PATH, file_path, as_attachment=True, conditional=True)
|
return send_from_directory(Constant.CONTENT_BUNDLE_FOLDER_PATH, file_path, as_attachment=True, conditional=True)
|
||||||
except ArcError as e:
|
except ArcError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user