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:
|
||||
return []
|
||||
|
||||
self.clear_expired_token()
|
||||
|
||||
self.c_m.executemany(
|
||||
'''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)
|
||||
|
||||
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),))
|
||||
|
||||
@@ -49,6 +49,7 @@ class Config:
|
||||
|
||||
DOWNLOAD_USE_NGINX_X_ACCEL_REDIRECT = False
|
||||
NGINX_X_ACCEL_REDIRECT_PREFIX = '/nginx_download/'
|
||||
BUNDLE_NGINX_X_ACCEL_REDIRECT_PREFIX = '/nginx_bundle_download/'
|
||||
|
||||
DOWNLOAD_TIMES_LIMIT = 3000
|
||||
DOWNLOAD_TIME_GAP_LIMIT = 1000
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from .config_manager import Config
|
||||
|
||||
ARCAEA_SERVER_VERSION = 'v2.11.3.14'
|
||||
ARCAEA_DATABASE_VERSION = 'v2.11.3.13'
|
||||
ARCAEA_SERVER_VERSION = 'v2.11.3.15'
|
||||
ARCAEA_DATABASE_VERSION = 'v2.11.3.15'
|
||||
ARCAEA_LOG_DATBASE_VERSION = 'v1.1'
|
||||
|
||||
|
||||
|
||||
@@ -450,10 +450,11 @@ class DatabaseMigrator:
|
||||
for j in range(30):
|
||||
rating = i[1 + j * 2]
|
||||
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:
|
||||
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:
|
||||
song_id = ''
|
||||
difficulty = 0
|
||||
|
||||
@@ -808,5 +808,23 @@
|
||||
],
|
||||
"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,
|
||||
"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
|
||||
response = make_response()
|
||||
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 send_from_directory(Constant.CONTENT_BUNDLE_FOLDER_PATH, file_path, as_attachment=True, conditional=True)
|
||||
except ArcError as e:
|
||||
|
||||
Reference in New Issue
Block a user