16 Commits
v2.2 ... v2.3.2

Author SHA1 Message Date
Lost-MSth
941a79ccc7 Update to v2.3.2 2021-04-09 14:42:14 +08:00
Lost-MSth
62902a561c Add an option 2021-04-05 14:45:50 +08:00
Lost-MSth
1660bc5899 Merge branch 'master' of https://github.com/Lost-MSth/Arcaea-server 2021-04-05 13:20:42 +08:00
Lost-MSth
d577246d28 Revert "Revert "Fix some bugs""
This reverts commit 9fd626468e.
2021-04-05 13:20:36 +08:00
Lost-MSth
9fd626468e Revert "Fix some bugs"
This reverts commit c51a1b4e85.
2021-04-05 13:19:32 +08:00
Lost-MSth
c51a1b4e85 Fix some bugs
Fix the fanmade cloud save (add a switch in setting)

Add SSL switch

Fix 'my rank' in game, if there is not enough people behind you, now it will show 20 people as expected
2021-04-05 13:02:56 +08:00
Lost-MSth
0e42123417 Update README.md
Well, it is not 4.1 now.
2021-04-02 22:03:35 +08:00
Lost-MSth
e216e6144b Update README.md 2021-04-01 17:05:53 +08:00
Lost-MSth
b70c435a4a Update to v2.3.1 2021-04-01 17:02:56 +08:00
Lost-MSth
eb03d2be93 Update README.md 2021-03-14 22:37:59 +08:00
Lost-MSth
fcb5d264ef Add something and fix something
Add character values.
Do something about #16.
Fix a problem about relative path.
2021-03-14 22:33:13 +08:00
Lost-MSth
d617951e1f Fix a bug(Follow last commit)
Ctrl c and Ctrl v,
A bug appears!
2021-03-09 20:09:58 +08:00
Lost-MSth
febf931f1a Fix something
I don't know if it is a bug and I haven't test it.

Maybe it makes low version arcaea can log in.
2021-03-09 19:47:54 +08:00
Lost-MSth
981961d6a1 Update README.md 2021-03-09 14:20:54 +08:00
Lost-MSth
a90380df4c Create error.log 2021-03-09 13:55:09 +08:00
Lost-MSth
4f66f492fc Update to v2.3 2021-03-09 13:46:49 +08:00
22 changed files with 1536 additions and 1236 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.log

View File

@@ -36,10 +36,11 @@ This procedure is mainly used for study and research, and shall not be used for
- 后台自定义信息 Customize some things in the background
- 成绩校验 Score check
- 下载校验 Download check
- 服务器日志 Server log
没有以下 We don't have
- 角色数值 Character characteristic value
- 服务器安全性保证 Server security assurance
- 世界模式下的搭档升级、觉醒,以及某些奖励的获取 Partner upgrading, uncapping, and receiving some rewards in the world mode
可能有问题 There may be problems
- Recent 30
@@ -59,29 +60,26 @@ It is just so interesting. What it can do is under exploration.
## 更新日志 Update log
只保留最新版本 Only keep the latest version.
> 提醒:更新时请注意保留原先的数据库,以防数据丢失
> 提醒:更新时请注意保留原先的数据库,以防数据丢失。使用前请先运行**database_initialize.py**以获得初始数据库。
>
> Tips: When updating, please keep the original database in case of data loss.
> Tips: When updating, please keep the original database in case of data loss.
> Before using, please run **database_initialize.py** to get the initial database.
### Version 2.2
- 适用于Arcaea 3.5.1版本 For Arcaea 3.5.1
### Version 2.3.2
- 适用于Arcaea 3.5.4版本 For Arcaea 3.5.4
- 更新了歌曲数据库 Update the song database.
- 新增多设备登录 Add multi device login.
- 修改了配置文件结构 The configuration file structure has been modified.
- 优化了代码结构 Optimize the code structure.
- 修复了一Bug Fix many bugs.
> 提醒:本次更新需重新登录
>
> Tip: You need to log in Arcaea again in this update.
- 新增运行前关键性文件检查 Add checking critical files before running.
- 新增可下载数据的客户端校验更新 Add client verification update of downloadable data.
- 新增歌曲成绩的谱面校验 Add checking chart file when submitting the song score.
- 修复了一Bug Fix some bugs.
## 运行环境与依赖 Running environment and requirements
- Windows操作系统 Windows operating system
- Windows/Linux/Mac OS/Android
- Python 3
- Flask模块 Flask module
- Charles
- Flask module
- Charles (optional)
<!--
## 环境搭建 Environment construction
[中文](https://github.com/Lost-MSth/Arcaea-server/wiki/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA)
[English](https://github.com/Lost-MSth/Arcaea-server/wiki/Environment-construction)
@@ -93,6 +91,7 @@ It is just so interesting. What it can do is under exploration.
## 注意 Attentions
[中文](https://github.com/Lost-MSth/Arcaea-server/wiki/%E6%B3%A8%E6%84%8F)
[English](https://github.com/Lost-MSth/Arcaea-server/wiki/Attentions)
-->
## 鸣谢 Thanks
歌曲数据库来自 Using song database from

Binary file not shown.

View File

@@ -236,24 +236,44 @@ primary key(user_id, code)
char = ['Hikari', 'Tairitsu', 'Kou', 'Sapphire', 'Lethe', '', 'Tairitsu(Axium)', 'Tairitsu(Grievous Lady)', 'Stella', 'Hikari & Fisica', 'Ilith', 'Eto', 'Luna', 'Shirabe', 'Hikari(Zero)', 'Hikari(Fracture)', 'Hikari(Summer)', 'Tairitsu(Summer)', 'Tairitsu & Trin',
'Ayu', 'Eto & Luna', 'Yume', 'Seine & Hikari', 'Saya', 'Tairitsu & Chuni Penguin', 'Chuni Penguin', 'Haruna', 'Nono', 'MTA-XXX', 'MDA-21', 'Kanae', 'Hikari(Fantasia)', 'Tairitsu(Sonata)', 'Sia', 'DORO*C', 'Tairitsu(Tempest)', 'Brillante', 'Ilith(Summer)', 'Etude', 'Alice & Tenniel', 'Luna & Mia', 'Areus', 'Seele', 'Isabelle']
'Ayu', 'Eto & Luna', 'Yume', 'Seine & Hikari', 'Saya', 'Tairitsu & Chuni Penguin', 'Chuni Penguin', 'Haruna', 'Nono', 'MTA-XXX', 'MDA-21', 'Kanae', 'Hikari(Fantasia)', 'Tairitsu(Sonata)', 'Sia', 'DORO*C', 'Tairitsu(Tempest)', 'Brillante', 'Ilith(Summer)', 'Etude', 'Alice & Tenniel', 'Luna & Mia', 'Areus', 'Seele', 'Isabelle', 'Mir']
skill_id = ['gauge_easy', '', '', '', 'note_mirror', '', '', 'gauge_hard', 'frag_plus_10_pack_stellights', 'gauge_easy|frag_plus_15_pst&prs', 'gauge_hard|fail_frag_minus_100', 'frag_plus_5_side_light', 'visual_hide_hp', 'frag_plus_5_side_conflict', 'challenge_fullcombo_0gauge', 'gauge_overflow', 'gauge_easy|note_mirror', 'note_mirror', 'visual_tomato_pack_tonesphere',
'frag_rng_ayu', 'gaugestart_30|gaugegain_70', 'combo_100-frag_1', 'audio_gcemptyhit_pack_groovecoaster', 'gauge_saya', 'gauge_chuni', 'kantandeshou', 'gauge_haruna', 'frags_nono', 'gauge_pandora', 'gauge_regulus', 'omatsuri_daynight', '', '', 'sometimes(note_mirror|frag_plus_5)', 'scoreclear_aa|visual_scoregauge', 'gauge_tempest', 'gauge_hard', 'gauge_ilith_summer', '', 'note_mirror|visual_hide_far', 'frags_ongeki', 'gauge_areus', 'gauge_seele', 'gauge_isabelle']
'frag_rng_ayu', 'gaugestart_30|gaugegain_70', 'combo_100-frag_1', 'audio_gcemptyhit_pack_groovecoaster', 'gauge_saya', 'gauge_chuni', 'kantandeshou', 'gauge_haruna', 'frags_nono', 'gauge_pandora', 'gauge_regulus', 'omatsuri_daynight', '', '', 'sometimes(note_mirror|frag_plus_5)', 'scoreclear_aa|visual_scoregauge', 'gauge_tempest', 'gauge_hard', 'gauge_ilith_summer', '', 'note_mirror|visual_hide_far', 'frags_ongeki', 'gauge_areus', 'gauge_seele', 'gauge_isabelle', 'gauge_exhaustion']
skill_id_uncap = ['', '', 'frags_kou', '', 'visual_ink', '', '', '', '', '', '', '', '', 'shirabe_entry_fee',
'', '', '', '', '', '', '', 'frags_yume', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
'', '', '', '', '', '', '', 'frags_yume', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
for i in range(0, 44):
frag = [88, 90, 100, 75, 80, 0, 70, 79, 65, 40, 50, 80, 90, 92, 0, 61, 67, 92, 85, 50, 86, 62,
65, 85, 67, 88, 74, 0.5, 105, 80, 95, 50, 80, 87, 71, 50, 95, 0, 80, 75, 50, 70, 80, 100, 65]
prog = [71, 90, 80, 75, 100, 0, 90, 102, 84, 78, 105, 67, 63, 78, 0, 99, 80, 66, 46, 83, 40, 83,
80, 90, 93, 50, 96, 88, 99, 108, 75, 80, 50, 64, 55, 100, 100, 110, 80, 50, 74, 90, 80, 80, 56]
overdrive = [71, 90, 57, 75, 80, 0, 95, 79, 65, 31, 50, 59, 90, 68, 0, 78, 50, 70, 62, 49, 64,
56, 73, 95, 67, 84, 80, 88, 79, 80, 50, 80, 80, 63, 25, 50, 82, 55, 50, 95, 55, 70, 100, 80, 90]
char_type = [1, 0, 0, 0, 0, 0, 0, 2, 0, 1, 2, 0, 0, 0, 2, 3, 1, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2, 1]
print(len(char))
print(len(skill_id))
print(len(skill_id_uncap))
print(len(frag))
print(len(prog))
print(len(overdrive))
print(len(char_type))
for i in range(0, 45):
if i in [0, 1, 2, 4, 13, 26, 27, 28, 29, 36, 21, 42, 43]:
sql = 'insert into character values('+str(
i)+',"'+char[i]+'''",30,25000,25000,90,90,90,"'''+skill_id[i]+'''",0,0,"'''+skill_id_uncap[i]+'''",0,'',1,1)'''
c.execute(sql)
sql = '''insert into character values(:a,:b,30,25000,25000,:c,:d,:e,:f,0,0,:g,:h,'',1,1)'''
c.execute(sql, {'a': i, 'b': char[i], 'c': frag[i], 'd': prog[i],
'e': overdrive[i], 'f': skill_id[i], 'g': skill_id_uncap[i], 'h': char_type[i]})
else:
if i != 5:
sql = 'insert into character values('+str(
i)+',"'+char[i]+'''",30,25000,25000,90,90,90,"'''+skill_id[i]+'''",0,0,"'''+skill_id_uncap[i]+'''",0,'',0,0)'''
c.execute(sql)
sql = '''insert into character values(:a,:b,20,10000,10000,:c,:d,:e,:f,0,0,:g,:h,'',0,0)'''
c.execute(sql, {'a': i, 'b': char[i], 'c': frag[i], 'd': prog[i],
'e': overdrive[i], 'f': skill_id[i], 'g': skill_id_uncap[i], 'h': char_type[i]})
def b2int(x):

View File

@@ -3,154 +3,154 @@
"items": [{
"type": "pack",
"id": "core",
"_id": "6008c2ff36651a07ebc52ca9",
"_id": "6046bab736651a07ebc537db",
"is_available": true
}],
"price": 500,
"price": 400,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "shiawase",
"items": [{
"type": "pack",
"id": "shiawase",
"_id": "6008c2ff36651a07ebc52ce0",
"_id": "6046bab736651a07ebc53823",
"is_available": true
}, {
"type": "character",
"id": "kou",
"_id": "6008c2ff36651a07ebc52cdf",
"_id": "6046bab736651a07ebc53822",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1552089600000,
"discount_to": 1552694399000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "dynamix",
"items": [{
"type": "pack",
"id": "dynamix",
"_id": "6008c2ff36651a07ebc52ce4",
"_id": "6046bab736651a07ebc53827",
"is_available": true
}, {
"type": "character",
"id": "sapphire",
"_id": "6008c2ff36651a07ebc52ce3",
"_id": "6046bab736651a07ebc53826",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "mirai",
"items": [{
"type": "pack",
"id": "mirai",
"_id": "6008c2ff36651a07ebc52cdc",
"_id": "6046bab736651a07ebc5381d",
"is_available": true
}, {
"type": "character",
"id": "lethe",
"_id": "6008c2ff36651a07ebc52cdb",
"_id": "6046bab736651a07ebc5381c",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1552089600000,
"discount_to": 1552694399000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "yugamu",
"items": [{
"type": "pack",
"id": "yugamu",
"_id": "6008c2ff36651a07ebc52caa",
"_id": "6046bab736651a07ebc537dc",
"is_available": true
}],
"price": 500,
"price": 400,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "lanota",
"items": [{
"type": "pack",
"id": "lanota",
"_id": "6008c2ff36651a07ebc52cd0",
"_id": "6046bab736651a07ebc537e8",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "nijuusei",
"items": [{
"type": "pack",
"id": "nijuusei",
"_id": "6008c2ff36651a07ebc52cab",
"_id": "6046bab736651a07ebc537dd",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "rei",
"items": [{
"type": "pack",
"id": "rei",
"_id": "6008c2ff36651a07ebc52cc5",
"_id": "6046bab736651a07ebc537f6",
"is_available": true
}],
"price": 500,
"price": 400,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "tonesphere",
"items": [{
"type": "pack",
"id": "tonesphere",
"_id": "6008c2ff36651a07ebc52cd2",
"_id": "6046bab736651a07ebc537ea",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "groovecoaster",
"items": [{
"type": "pack",
"id": "groovecoaster",
"_id": "6008c2ff36651a07ebc52ca1",
"_id": "6046bab736651a07ebc53812",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "zettai",
"items": [{
"type": "pack",
"id": "zettai",
"_id": "6008c2ff36651a07ebc52cc7",
"_id": "6046bab736651a07ebc537f8",
"is_available": true
}],
"price": 500,
"price": 250,
"orig_price": 500,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "chunithm",
"items": [{
"type": "pack",
"id": "chunithm",
"_id": "6008c2ff36651a07ebc52cbb",
"_id": "6046bab736651a07ebc53806",
"is_available": true
}],
"price": 300,
@@ -160,47 +160,55 @@
"items": [{
"type": "pack",
"id": "prelude",
"_id": "6008c2ff36651a07ebc52ca2",
"_id": "6046bab736651a07ebc53813",
"is_available": true
}],
"price": 400,
"orig_price": 400
"price": 250,
"orig_price": 400,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "omatsuri",
"items": [{
"type": "pack",
"id": "omatsuri",
"_id": "6008c2ff36651a07ebc52cc8",
"_id": "6046bab736651a07ebc537f9",
"is_available": true
}],
"price": 500,
"orig_price": 500
"price": 250,
"orig_price": 500,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "vs",
"items": [{
"type": "pack",
"id": "vs",
"_id": "6008c2ff36651a07ebc52cbe",
"_id": "6046bab736651a07ebc53809",
"is_available": true
}],
"price": 500,
"orig_price": 500
"price": 400,
"orig_price": 500,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "extend",
"items": [{
"type": "pack",
"id": "extend",
"_id": "6008c2ff36651a07ebc52ca5",
"_id": "6046bab736651a07ebc53816",
"is_available": true
}],
"price": 700,
"orig_price": 700
"price": 500,
"orig_price": 700,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "alice",
"items": [{
"type": "pack",
"id": "alice",
"_id": "6008c2ff36651a07ebc52ccd",
"_id": "6046bab736651a07ebc537fe",
"is_available": true
}],
"orig_price": 500,
@@ -210,7 +218,7 @@
"items": [{
"type": "pack",
"id": "alice_append_1",
"_id": "6008c2ff36651a07ebc52cb4",
"_id": "6046bab736651a07ebc537e6",
"is_available": true
}],
"orig_price": 300,
@@ -220,7 +228,7 @@
"items": [{
"type": "pack",
"id": "ongeki",
"_id": "6008c2ff36651a07ebc52cc1",
"_id": "6046bab736651a07ebc5380c",
"is_available": true
}],
"orig_price": 400,
@@ -230,7 +238,7 @@
"items": [{
"type": "pack",
"id": "maimai",
"_id": "6008c2ff36651a07ebc52ca8",
"_id": "6046bab736651a07ebc53819",
"is_available": true
}],
"orig_price": 400,
@@ -240,7 +248,7 @@
"items": [{
"type": "pack",
"id": "chunithm_append_1",
"_id": "6008c2ff36651a07ebc52cda",
"_id": "6046bab736651a07ebc537f2",
"is_available": true
}],
"orig_price": 300,

View File

@@ -12,55 +12,55 @@
"items": [{
"id": "dataerror",
"type": "single",
"_id": "6008c2ff36651a07ebc52cb5",
"_id": "606f9f5636651a07ebc541f3",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "yourvoiceso",
"items": [{
"id": "yourvoiceso",
"type": "single",
"_id": "6008c2ff36651a07ebc52cc2",
"_id": "606f9f5636651a07ebc54201",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "crosssoul",
"items": [{
"id": "crosssoul",
"type": "single",
"_id": "6008c2ff36651a07ebc52ccf",
"_id": "606f9f5636651a07ebc5420e",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "impurebird",
"items": [{
"type": "single",
"id": "impurebird",
"_id": "6008c2ff36651a07ebc52cb6",
"_id": "606f9f5636651a07ebc541f4",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "auxesia",
"items": [{
"type": "single",
"id": "auxesia",
"_id": "6008c2ff36651a07ebc52c9d",
"_id": "606f9f5636651a07ebc5420f",
"is_available": true
}],
"price": 100,
@@ -72,43 +72,43 @@
"items": [{
"type": "single",
"id": "modelista",
"_id": "6008c2ff36651a07ebc52cc3",
"_id": "606f9f5636651a07ebc54202",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "yozakurafubuki",
"items": [{
"type": "single",
"id": "yozakurafubuki",
"_id": "6008c2ff36651a07ebc52cb7",
"_id": "606f9f5636651a07ebc541f5",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "surrender",
"items": [{
"type": "single",
"id": "surrender",
"_id": "6008c2ff36651a07ebc52c9e",
"_id": "606f9f5636651a07ebc54210",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "metallicpunisher",
"items": [{
"type": "single",
"id": "metallicpunisher",
"_id": "6008c2ff36651a07ebc52cc4",
"_id": "606f9f5636651a07ebc54203",
"is_available": true
}],
"price": 100,
@@ -118,7 +118,7 @@
"items": [{
"type": "single",
"id": "carminescythe",
"_id": "6008c2ff36651a07ebc52cb8",
"_id": "606f9f5636651a07ebc541f6",
"is_available": true
}],
"price": 100,
@@ -128,79 +128,79 @@
"items": [{
"type": "single",
"id": "bethere",
"_id": "6008c2ff36651a07ebc52c9f",
"_id": "606f9f5636651a07ebc54211",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "callmyname",
"items": [{
"type": "single",
"id": "callmyname",
"_id": "6008c2ff36651a07ebc52cd1",
"_id": "606f9f5636651a07ebc5421c",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "fallensquare",
"items": [{
"type": "single",
"id": "fallensquare",
"_id": "6008c2ff36651a07ebc52cac",
"_id": "606f9f5636651a07ebc541e9",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "dropdead",
"items": [{
"type": "single",
"id": "dropdead",
"_id": "6008c2ff36651a07ebc52cb9",
"_id": "606f9f5636651a07ebc541f7",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "alexandrite",
"items": [{
"type": "single",
"id": "alexandrite",
"_id": "6008c2ff36651a07ebc52ca0",
"_id": "606f9f5636651a07ebc54212",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "astraltale",
"items": [{
"type": "single",
"id": "astraltale",
"_id": "6008c2ff36651a07ebc52cc6",
"_id": "606f9f5636651a07ebc54205",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "phantasia",
"items": [{
"type": "single",
"id": "phantasia",
"_id": "6008c2ff36651a07ebc52cad",
"_id": "606f9f5636651a07ebc541ea",
"is_available": true
}],
"price": 100,
@@ -210,7 +210,7 @@
"items": [{
"type": "single",
"id": "empireofwinter",
"_id": "6008c2ff36651a07ebc52cba",
"_id": "606f9f5636651a07ebc541f8",
"is_available": true
}],
"price": 100,
@@ -220,75 +220,79 @@
"items": [{
"type": "single",
"id": "libertas",
"_id": "6008c2ff36651a07ebc52cd3",
"_id": "606f9f5636651a07ebc5421e",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "dottodot",
"items": [{
"type": "single",
"id": "dottodot",
"_id": "6008c2ff36651a07ebc52cae",
"_id": "606f9f5636651a07ebc541eb",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "dreadnought",
"items": [{
"type": "single",
"id": "dreadnought",
"_id": "6008c2ff36651a07ebc52cd4",
"_id": "606f9f5636651a07ebc5421f",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "mirzam",
"items": [{
"type": "single",
"id": "mirzam",
"_id": "6008c2ff36651a07ebc52caf",
"_id": "606f9f5636651a07ebc541ec",
"is_available": true
}],
"price": 100,
"orig_price": 100,
"discount_from": 1583712000000,
"discount_to": 1584316799000
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "heavenlycaress",
"items": [{
"type": "single",
"id": "heavenlycaress",
"_id": "6008c2ff36651a07ebc52cbc",
"_id": "606f9f5636651a07ebc541fa",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "filament",
"items": [{
"type": "single",
"id": "filament",
"_id": "6008c2ff36651a07ebc52ca3",
"_id": "606f9f5636651a07ebc54215",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "avantraze",
"items": [{
"type": "single",
"id": "avantraze",
"_id": "6008c2ff36651a07ebc52cd5",
"_id": "606f9f5636651a07ebc54220",
"is_available": true
}],
"price": 100,
@@ -298,17 +302,19 @@
"items": [{
"type": "single",
"id": "battlenoone",
"_id": "6008c2ff36651a07ebc52cc9",
"_id": "606f9f5636651a07ebc54208",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "saikyostronger",
"items": [{
"type": "single",
"id": "saikyostronger",
"_id": "6008c2ff36651a07ebc52cb0",
"_id": "606f9f5636651a07ebc541ed",
"is_available": true
}],
"price": 100,
@@ -318,67 +324,79 @@
"items": [{
"type": "single",
"id": "izana",
"_id": "6008c2ff36651a07ebc52cbd",
"_id": "606f9f5636651a07ebc541fb",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "einherjar",
"items": [{
"type": "single",
"id": "einherjar",
"_id": "6008c2ff36651a07ebc52ca4",
"_id": "606f9f5636651a07ebc54216",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "laqryma",
"items": [{
"type": "single",
"id": "laqryma",
"_id": "6008c2ff36651a07ebc52cd6",
"_id": "606f9f5636651a07ebc54221",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "amygdata",
"items": [{
"type": "single",
"id": "amygdata",
"_id": "6008c2ff36651a07ebc52cca",
"_id": "606f9f5636651a07ebc54209",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "altale",
"items": [{
"type": "single",
"id": "altale",
"_id": "6008c2ff36651a07ebc52cb1",
"_id": "606f9f5636651a07ebc541ee",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "feelssoright",
"items": [{
"type": "single",
"id": "feelssoright",
"_id": "6008c2ff36651a07ebc52cd7",
"_id": "606f9f5636651a07ebc54222",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "scarletcage",
"items": [{
"type": "single",
"id": "scarletcage",
"_id": "6008c2ff36651a07ebc52ccb",
"_id": "606f9f5636651a07ebc5420a",
"is_available": true
}],
"price": 100,
@@ -388,7 +406,7 @@
"items": [{
"type": "single",
"id": "teriqma",
"_id": "6008c2ff36651a07ebc52cb2",
"_id": "606f9f5636651a07ebc541ef",
"is_available": true
}],
"price": 100,
@@ -398,27 +416,31 @@
"items": [{
"type": "single",
"id": "mahoroba",
"_id": "6008c2ff36651a07ebc52cbf",
"_id": "606f9f5636651a07ebc541fd",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "badtek",
"items": [{
"type": "single",
"id": "badtek",
"_id": "6008c2ff36651a07ebc52cd8",
"_id": "606f9f5636651a07ebc54223",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "maliciousmischance",
"items": [{
"type": "single",
"id": "maliciousmischance",
"_id": "6008c2ff36651a07ebc52ccc",
"_id": "606f9f5636651a07ebc54218",
"is_available": true
}],
"price": 100,
@@ -428,7 +450,7 @@
"items": [{
"type": "single",
"id": "buchigireberserker",
"_id": "6008c2ff36651a07ebc52cb3",
"_id": "606f9f5636651a07ebc541f0",
"is_available": true
}],
"price": 100,
@@ -438,17 +460,19 @@
"items": [{
"type": "single",
"id": "galaxyfriends",
"_id": "6008c2ff36651a07ebc52cc0",
"_id": "606f9f5636651a07ebc541fe",
"is_available": true
}],
"price": 100,
"orig_price": 100
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, {
"name": "xeraphinite",
"items": [{
"type": "single",
"id": "xeraphinite",
"_id": "6008c2ff36651a07ebc52ca7",
"_id": "606f9f5636651a07ebc54219",
"is_available": true
}],
"orig_price": 100,
@@ -458,7 +482,7 @@
"items": [{
"type": "single",
"id": "xanatos",
"_id": "6008c2ff36651a07ebc52cd9",
"_id": "606f9f5636651a07ebc54224",
"is_available": true
}],
"price": 100,
@@ -468,7 +492,27 @@
"items": [{
"type": "single",
"id": "attraqtia",
"_id": "6008c2ff36651a07ebc52cce",
"_id": "606f9f5636651a07ebc5420d",
"is_available": true
}],
"orig_price": 100,
"price": 100
}, {
"name": "gimmedablood",
"items": [{
"type": "single",
"id": "gimmedablood",
"_id": "606f9f5636651a07ebc541f2",
"is_available": true
}],
"orig_price": 100,
"price": 100
}, {
"name": "bassline",
"items": [{
"type": "single",
"id": "bassline",
"_id": "606f9f5636651a07ebc54200",
"is_available": true
}],
"orig_price": 100,

View File

View File

@@ -13,7 +13,9 @@ import web.index
import server.arcworld
import server.arcdownload
import server.arcpurchase
import server.init
import os
import sys
app = Flask(__name__)
@@ -89,7 +91,11 @@ def login():
id_pwd = headers['Authorization']
id_pwd = base64.b64decode(id_pwd[6:]).decode()
name, password = id_pwd.split(':', 1)
device_id = headers['DeviceId']
if 'DeviceId' in headers:
device_id = headers['DeviceId']
else:
device_id = 'low_version'
token, error_code = server.auth.arc_login(name, password, device_id)
if not error_code:
r = {"success": True, "token_type": "Bearer"}
@@ -103,7 +109,11 @@ def login():
def register():
name = request.form['name']
password = request.form['password']
device_id = request.form['device_id']
if 'device_id' in request.form:
device_id = request.form['device_id']
else:
device_id = 'low_version'
user_id, token, error_code = server.auth.arc_register(
name, password, device_id)
if user_id is not None:
@@ -513,19 +523,58 @@ def sys_set(user_id, path):
def main():
os.chdir(sys.path[0]) # 更改工作路径,以便于愉快使用相对路径
app.config.from_mapping(SECRET_KEY=Config.SECRET_KEY)
app.config['SESSION_TYPE'] = 'filesystem'
app.register_blueprint(web.login.bp)
app.register_blueprint(web.index.bp)
dictConfig({
log_dict = {
'version': 1,
'formatters': {'default': {
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
}},
'root': {
'level': 'INFO'
'level': 'INFO',
'handlers': ['wsgi', 'error_file']
},
'handlers': {
'wsgi': {
'class': 'logging.StreamHandler',
'stream': 'ext://flask.logging.wsgi_errors_stream',
'formatter': 'default'
},
"error_file": {
"class": "logging.handlers.RotatingFileHandler",
"maxBytes": 1024 * 1024,
"backupCount": 1,
"encoding": "utf-8",
"level": "ERROR",
"formatter": "default",
"filename": "./log/error.log"
}
},
'formatters': {
'default': {
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s'
}
}
})
}
if Config.ALLOW_LOG_INFO:
log_dict['root']['handlers'] = ['wsgi', 'info_file', 'error_file']
log_dict['handlers']['info_file'] = {
"class": "logging.handlers.RotatingFileHandler",
"maxBytes": 1024 * 1024,
"backupCount": 1,
"encoding": "utf-8",
"level": "INFO",
"formatter": "default",
"filename": "./log/info.log"
}
dictConfig(log_dict)
if not server.init.check_before_run(app):
app.logger.error('Something wrong. The server will not run.')
input('Press ENTER key to exit.')
sys.exit()
app.logger.info("Start to initialize data in 'songfile' table...")
try:
@@ -537,7 +586,11 @@ def main():
else:
app.logger.info('Complete!')
app.run(Config.HOST, Config.PORT)
if Config.SSL_CERT and Config.SSL_KEY:
app.run(Config.HOST, Config.PORT, ssl_context=(
Config.SSL_CERT, Config.SSL_KEY))
else:
app.run(Config.HOST, Config.PORT)
if __name__ == '__main__':

View File

@@ -25,7 +25,24 @@ def get_file_md5(file_path):
return myhash.hexdigest()
def get_one_song(c, user_id, song_id, file_dir='./database/songs'):
def get_url(file_path, **kwargs):
# 获取下载地址
t = ''
if 't' in kwargs:
t = kwargs['t']
if Config.DOWNLOAD_LINK_PREFIX:
prefix = Config.DOWNLOAD_LINK_PREFIX
if prefix[-1] != '/':
prefix += '/'
return prefix + file_path + '?t=' + t
else:
return url_for('download', file_path=file_path, t=t, _external=True)
def get_one_song(c, user_id, song_id, file_dir='./database/songs', url_flag=True):
# 获取一首歌的下载链接,返回字典
dir_list = os.listdir(os.path.join(file_dir, song_id))
re = {}
@@ -37,7 +54,6 @@ def get_one_song(c, user_id, song_id, file_dir='./database/songs'):
if os.path.isfile(os.path.join(file_dir, song_id, i)) and i in ['0.aff', '1.aff', '2.aff', '3.aff', 'base.ogg']:
token = hashlib.md5(
(str(user_id) + song_id + i + str(now)).encode(encoding='UTF-8')).hexdigest()
token = token[:8]
if i == 'base.ogg':
c.execute(
@@ -48,8 +64,12 @@ def get_one_song(c, user_id, song_id, file_dir='./database/songs'):
else:
checksum = get_file_md5(os.path.join(
file_dir, song_id, 'base.ogg'))
re['audio'] = {"checksum": checksum,
"url": url_for('download', file_path=song_id+'/base.ogg', t=token, _external=True)}
if url_flag:
re['audio'] = {"checksum": checksum, "url": get_url(
file_path=song_id+'/base.ogg', t=token)}
else:
re['audio'] = {"checksum": checksum}
else:
if 'chart' not in re:
re['chart'] = {}
@@ -60,23 +80,28 @@ def get_one_song(c, user_id, song_id, file_dir='./database/songs'):
checksum = x[0]
else:
checksum = get_file_md5(os.path.join(file_dir, song_id, i))
re['chart'][i[0]] = {"checksum": checksum,
"url": url_for('download', file_path=song_id+'/'+i, t=token, _external=True)}
c.execute('''insert into download_token values(:a,:b,:c,:d,:e)''', {
'a': user_id, 'b': song_id, 'c': i, 'd': token, 'e': now})
if url_flag:
re['chart'][i[0]] = {"checksum": checksum, "url": get_url(
file_path=song_id+'/'+i, t=token)}
else:
re['chart'][i[0]] = {"checksum": checksum}
if url_flag:
c.execute('''insert into download_token values(:a,:b,:c,:d,:e)''', {
'a': user_id, 'b': song_id, 'c': i, 'd': token, 'e': now})
return {song_id: re}
def get_all_songs(user_id, file_dir='./database/songs'):
def get_all_songs(user_id, file_dir='./database/songs', url_flag=True):
# 获取所有歌的下载链接,返回字典
dir_list = os.listdir(file_dir)
re = {}
with Connect() as c:
for i in dir_list:
if os.path.isdir(os.path.join(file_dir, i)):
re.update(get_one_song(c, user_id, i, file_dir))
re.update(get_one_song(c, user_id, i, file_dir, url_flag))
return re

File diff suppressed because it is too large Load Diff

View File

@@ -111,9 +111,9 @@ def arc_register(name: str, password: str, device_id: str): # 注册
user_id = build_user_id(c)
now = int(time.time() * 1000)
c.execute('''insert into user(user_id, name, password, join_date, user_code, rating_ptt,
character_id, is_skill_sealed, is_char_uncapped, is_char_uncapped_override, is_hide_rating, favorite_character, max_stamina_notification_enabled, current_map, ticket)
values(:user_id, :name, :password, :join_date, :user_code, 0, 0, 0, 0, 0, 0, -1, 0, '', 0)
''', {'user_code': user_code, 'user_id': user_id, 'join_date': now, 'name': name, 'password': hash_pwd})
character_id, is_skill_sealed, is_char_uncapped, is_char_uncapped_override, is_hide_rating, favorite_character, max_stamina_notification_enabled, current_map, ticket, prog_boost)
values(:user_id, :name, :password, :join_date, :user_code, 0, 0, 0, 0, 0, 0, -1, 0, '', :memories, 0)
''', {'user_code': user_code, 'user_id': user_id, 'join_date': now, 'name': name, 'password': hash_pwd, 'memories': Config.DEFAULT_MEMORIES})
c.execute('''insert into recent30(user_id) values(:user_id)''', {
'user_id': user_id})
@@ -168,9 +168,10 @@ def auth_required(request):
user_id = None
with Connect() as c:
headers = request.headers
token = headers['Authorization']
token = token[7:]
user_id = token_get_id(token)
if 'Authorization' in headers:
token = headers['Authorization']
token = token[7:]
user_id = token_get_id(token)
if user_id is not None:
return view(user_id, *args, **kwargs)

View File

@@ -1,7 +1,9 @@
from server.sql import Connect
import server.arcworld
import server.arcpurchase
import server.arcdownload
import time
from setting import Config
def int2b(x):
@@ -174,7 +176,7 @@ def get_value_0(c, user_id):
if x[27] and x[27] != 0:
prog_boost = 300
r = {"is_aprilfools": False,
r = {"is_aprilfools": Config.IS_APRILFOOLS,
"curr_available_maps": [],
"character_stats": user_character,
"friends": get_user_friend(c, user_id),
@@ -197,10 +199,9 @@ def get_value_0(c, user_id):
"max_stamina_ts": 1586274871917,
"stamina": 12,
"world_unlocks": ["scenery_chap1", "scenery_chap2", "scenery_chap3", "scenery_chap4", "scenery_chap5"],
"world_songs": ["babaroque", "shadesoflight", "kanagawa", "lucifer", "anokumene", "ignotus", "rabbitintheblackroom", "qualia", "redandblue", "bookmaker", "darakunosono", "espebranch", "blacklotus", "givemeanightmare", "vividtheory", "onefr", "gekka", "vexaria3", "infinityheaven3", "fairytale3", "goodtek3", "suomi", "rugie", "faintlight", "harutopia", "goodtek", "dreaminattraction", "syro", "diode", "freefall", "grimheart", "blaster", "cyberneciacatharsis", "monochromeprincess", "revixy", "vector", "supernova", "nhelv", "purgatorium3", "dement3", "crossover", "guardina", "axiumcrisis", "worldvanquisher", "sheriruth", "pragmatism", "gloryroad", "etherstrike", "corpssansorganes", "lostdesire", "blrink", "essenceoftwilight", "lapis", "solitarydream", "lumia3", "purpleverse", "moonheart3", "glow", "enchantedlove", "take"],
"singles": get_user_singles(c, user_id), # ["dataerror", "yourvoiceso", "crosssoul", "impurebird", "auxesia", "modelista", "yozakurafubuki", "surrender", "metallicpunisher", "carminescythe", "bethere", "callmyname", "fallensquare", "dropdead", "alexandrite", "astraltale", "phantasia", "empireofwinter", "libertas", "dottodot", "dreadnought", "mirzam", "heavenlycaress", "filament", "avantraze", "battlenoone", "saikyostronger", "izana", "einherjar", "laqryma", "amygdata", "altale", "feelssoright", "scarletcage", "teriqma", "mahoroba", "badtek", "maliciousmischance", "buchigireberserker", "galaxyfriends", "xeraphinite", "xanatos"]
"world_songs": ["babaroque", "shadesoflight", "kanagawa", "lucifer", "anokumene", "ignotus", "rabbitintheblackroom", "qualia", "redandblue", "bookmaker", "darakunosono", "espebranch", "blacklotus", "givemeanightmare", "vividtheory", "onefr", "gekka", "vexaria3", "infinityheaven3", "fairytale3", "goodtek3", "suomi", "rugie", "faintlight", "harutopia", "goodtek", "dreaminattraction", "syro", "diode", "freefall", "grimheart", "blaster", "cyberneciacatharsis", "monochromeprincess", "revixy", "vector", "supernova", "nhelv", "purgatorium3", "dement3", "crossover", "guardina", "axiumcrisis", "worldvanquisher", "sheriruth", "pragmatism", "gloryroad", "etherstrike", "corpssansorganes", "lostdesire", "blrink", "essenceoftwilight", "lapis", "solitarydream", "lumia3", "purpleverse", "moonheart3", "glow", "enchantedlove", "take", "lifeispiano"],
"singles": get_user_singles(c, user_id),
"packs": get_user_packs(c, user_id),
# ["vs", "extend", "dynamix", "prelude", "core", "yugamu", "omatsuri", "zettai", "mirai", "shiawase", "chunithm", "nijuusei", "groovecoaster", "rei", "tonesphere", "lanota"]
"characters": characters,
"cores": [],
"recent_score": get_recent_score(c, user_id),
@@ -226,7 +227,7 @@ def arc_aggregate_small(user_id):
def arc_aggregate_big(user_id):
# 返回用户数据和地图歌曲信息
# 返回比较全的用户数据
r = {"success": False}
with Connect() as c:
r = {"success": True,
@@ -238,7 +239,7 @@ def arc_aggregate_big(user_id):
"value": server.arcpurchase.get_item(c, 'pack')
}, {
"id": 2,
"value": {}
"value": server.arcdownload.get_all_songs(user_id, url_flag=False)
}, {
"id": 3,
"value": {

View File

@@ -0,0 +1,29 @@
import os
def check_before_run(app):
# 运行前检查关键文件,返回布尔值,其实是因为有人经常忘了
f = True
if not os.path.exists('setting.py'):
app.logger.warning('File `setting.py` is missing.')
f = False
if not os.path.exists('database'):
app.logger.warning('Folder `database` is missing.')
f = False
if not os.path.exists('database/songs'):
app.logger.warning('Folder `database/songs` is missing.')
f = False
if not os.path.exists('database/arcaea_database.db'):
app.logger.warning('File `database/arcaea_database.db` is missing.')
f = False
if not os.path.exists('database/arcsong.db'):
app.logger.warning('File `database/arcsong.db` is missing.')
f = False
return f

View File

@@ -1,4 +1,6 @@
import sqlite3
from flask import current_app
import traceback
class Connect():
@@ -22,4 +24,8 @@ class Connect():
self.conn.commit()
self.conn.close()
if exc_type is not None:
current_app.logger.error(
traceback.format_exception(exc_type, exc_val, exc_tb))
return True

View File

@@ -14,6 +14,29 @@ class Config():
--------------------
'''
'''
--------------------
SSL证书路径
留空则使用HTTP
SSL certificate path
If left blank, use HTTP.
'''
SSL_CERT = '' # *.pem
SSL_KEY = '' # *.key
'''
--------------------
'''
'''
--------------------
愚人节模式开关
Switch of April Fool's Day
'''
IS_APRILFOOLS = True
'''
--------------------
'''
'''
--------------------
Web后台管理页面的用户名和密码
@@ -38,8 +61,19 @@ class Config():
'''
--------------------
玩家歌曲下载的24小时次数限制
Player's song download limit times in 24 hours
歌曲下载地址前缀,留空则自动获取
Song download address prefix
If left blank, it will be obtained automatically.
'''
DOWNLOAD_LINK_PREFIX = '' # http://***.com/download/
'''
--------------------
'''
'''
--------------------
玩家歌曲下载的24小时次数限制每个文件算一次
Player's song download limit times in 24 hours, once per file
'''
DOWNLOAD_TIMES_LIMIT = 3000
'''
@@ -59,9 +93,39 @@ class Config():
LOGIN_DEVICE_NUMBER_LIMIT = 1
'''
是否允许同设备多应用共存登录
If multiple applications on the same device to log in is allowed
If logging in from multiple applications on the same device is allowed
'''
ALLOW_LOGIN_SAME_DEVICE = False
'''
--------------------
'''
'''
--------------------
是否记录详细的服务器日志
If recording detailed server logs is enabled
'''
ALLOW_LOG_INFO = False
'''
--------------------
'''
'''
--------------------
用户注册时的默认记忆源点数量
The default amount of memories at the time of user registration
'''
DEFAULT_MEMORIES = 0
'''
--------------------
'''
'''
--------------------
是否强制使用全解锁云端存档
If forcing full unlocked cloud save is enabled
'''
SAVE_FULL_UNLOCK = False
'''
--------------------
'''

View File

@@ -11,6 +11,9 @@
<div class="name">{{user['name']}}
<span class="rank">UID: {{user['user_id']}}</span>
<span class="rank">User code: {{user['user_code']}}</span>
{% if user['ban_flag'] %}
<span class="rank">Banned</span>
{% endif %}
</div>
<div class="join-date">注册于 Registered in: {{user['join_date']}}</div>
<div class="ptt">PTT: {{'%0.2f'|format(user['rating_ptt']/100|float)}}</div>

View File

@@ -22,6 +22,9 @@
<div class="name">{{user['name']}}
<span class="rank">UID: {{user['user_id']}}</span>
<span class="rank">User code: {{user['user_code']}}</span>
{% if user['ban_flag'] %}
<span class="rank">Banned</span>
{% endif %}
</div>
<div class="join-date">注册于 Registered in: {{user['join_date']}}</div>
<div class="ptt">Memories: {{user['ticket']}}</div>
@@ -161,7 +164,7 @@
{% if recent %}
<div class="title">Recent 30</div>
{% for i in recent %}
{% if i %}
<div class="score-item">
<span class="song-title">

View File

@@ -138,6 +138,11 @@ def all_player():
if i[20]:
time_played = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(int(i[20])//1000))
if i[2] == '':
ban_flag = True
else:
ban_flag = False
posts.append({'name': i[1],
'user_id': i[0],
'join_date': join_date,
@@ -153,7 +158,8 @@ def all_player():
'time_played': time_played,
'clear_type': i[21],
'rating': i[22],
'ticket': i[26]
'ticket': i[26],
'ban_flag': ban_flag
})
else:
error = '没有玩家数据 No player data.'

View File

@@ -3,6 +3,7 @@ from flask import (Blueprint, flash, g, redirect,
render_template, request, session, url_for)
import functools
from setting import Config
import hashlib
bp = Blueprint('login', __name__, url_prefix='/web')
@@ -20,7 +21,11 @@ def login():
if error is None:
session.clear()
session['user_id'] = Config.USERNAME + Config.PASSWORD
hash_session = username + \
hashlib.sha256(password.encode("utf8")).hexdigest()
hash_session = hashlib.sha256(
hash_session.encode("utf8")).hexdigest()
session['user_id'] = hash_session
return redirect(url_for('index.index'))
flash(error)
@@ -42,7 +47,11 @@ def login_required(view):
def wrapped_view(**kwargs):
x = session.get('user_id')
if x != Config.USERNAME + Config.PASSWORD:
hash_session = Config.USERNAME + \
hashlib.sha256(Config.PASSWORD.encode("utf8")).hexdigest()
hash_session = hashlib.sha256(hash_session.encode("utf8")).hexdigest()
if x != hash_session:
return redirect(url_for('login.login'))
g.user = {'user_id': x, 'username': Config.USERNAME}

View File

@@ -1,5 +1,5 @@
import os
import sqlite3
from server.sql import Connect
import time
import json
import server.arcscore
@@ -179,46 +179,34 @@ def update_database():
# 对于arcaea_datebase.db更新一些表并用character数据更新user_char
# 对于arcsong.db更新songs
if os.path.isfile("database/old_arcaea_database.db") and os.path.isfile("database/arcaea_database.db"):
conn1 = sqlite3.connect('./database/old_arcaea_database.db')
c1 = conn1.cursor()
conn2 = sqlite3.connect('./database/arcaea_database.db')
c2 = conn2.cursor()
with Connect('./database/old_arcaea_database.db') as c1:
with Connect() as c2:
update_one_table(c1, c2, 'user')
update_one_table(c1, c2, 'friend')
update_one_table(c1, c2, 'best_score')
update_one_table(c1, c2, 'recent30')
update_one_table(c1, c2, 'user_world')
update_one_table(c1, c2, 'item')
update_one_table(c1, c2, 'user_item')
update_one_table(c1, c2, 'user_save')
update_one_table(c1, c2, 'login')
update_one_table(c1, c2, 'present')
update_one_table(c1, c2, 'user_present')
update_one_table(c1, c2, 'redeem')
update_one_table(c1, c2, 'user_redeem')
update_one_table(c1, c2, 'user')
update_one_table(c1, c2, 'friend')
update_one_table(c1, c2, 'best_score')
update_one_table(c1, c2, 'recent30')
update_one_table(c1, c2, 'user_world')
update_one_table(c1, c2, 'item')
update_one_table(c1, c2, 'user_item')
update_one_table(c1, c2, 'user_save')
update_one_table(c1, c2, 'login')
update_one_table(c1, c2, 'present')
update_one_table(c1, c2, 'user_present')
update_one_table(c1, c2, 'redeem')
update_one_table(c1, c2, 'user_redeem')
update_user_char(c2)
update_user_char(c2)
conn1.commit()
conn1.close()
conn2.commit()
conn2.close()
os.remove('database/old_arcaea_database.db')
# songs
if os.path.isfile("database/old_arcsong.db") and os.path.isfile("database/arcsong.db"):
conn1 = sqlite3.connect('./database/old_arcsong.db')
c1 = conn1.cursor()
conn2 = sqlite3.connect('./database/arcsong.db')
c2 = conn2.cursor()
with Connect('./database/old_arcsong.db') as c1:
with Connect('./database/arcsong.db') as c2:
update_one_table(c1, c2, 'songs')
update_one_table(c1, c2, 'songs')
conn1.commit()
conn1.close()
conn2.commit()
conn2.close()
os.remove('database/old_arcsong.db')
@@ -257,34 +245,31 @@ def unlock_user_item(c, user_id):
def get_all_item():
# 所有购买数据查询
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
c.execute('''select * from item''')
x = c.fetchall()
re = []
if x:
for i in x:
discount_from = None
discount_to = None
with Connect() as c:
c.execute('''select * from item''')
x = c.fetchall()
re = []
if x:
for i in x:
discount_from = None
discount_to = None
if i[5] and i[5] >= 0:
discount_from = time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(int(i[5])/1000))
if i[6] and i[6] >= 0:
discount_to = time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(int(i[6])//1000))
if i[5] and i[5] >= 0:
discount_from = time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(int(i[5])/1000))
if i[6] and i[6] >= 0:
discount_to = time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(int(i[6])//1000))
re.append({'item_id': i[0],
'type': i[1],
'is_available': int2b(i[2]),
'price': i[3],
'orig_price': i[4],
'discount_from': discount_from,
'discount_to': discount_to
})
re.append({'item_id': i[0],
'type': i[1],
'is_available': int2b(i[2]),
'price': i[3],
'orig_price': i[4],
'discount_from': discount_from,
'discount_to': discount_to
})
conn.commit()
conn.close()
return re
@@ -346,19 +331,16 @@ def add_one_present(present_id, expire_ts, description, items):
# 添加一个奖励
message = None
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
c.execute(
'''select exists(select * from present where present_id=:a)''', {'a': present_id})
if c.fetchone() == (0,):
c.execute('''insert into present values(:a,:b,:c,:d)''', {
'a': present_id, 'b': expire_ts, 'c': items, 'd': description})
message = '添加成功 Successfully add it.'
else:
message = '奖励已存在 The present exists.'
with Connect() as c:
c.execute(
'''select exists(select * from present where present_id=:a)''', {'a': present_id})
if c.fetchone() == (0,):
c.execute('''insert into present values(:a,:b,:c,:d)''', {
'a': present_id, 'b': expire_ts, 'c': items, 'd': description})
message = '添加成功 Successfully add it.'
else:
message = '奖励已存在 The present exists.'
conn.commit()
conn.close()
return message
@@ -366,21 +348,18 @@ def delete_one_present(present_id):
# 删除一个奖励
message = None
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
c.execute(
'''select exists(select * from present where present_id=:a)''', {'a': present_id})
if c.fetchone() == (1,):
c.execute('''delete from present where present_id = :a''',
{'a': present_id})
c.execute('''delete from user_present where present_id =:a''', {
'a': present_id})
message = '删除成功 Successfully delete it.'
else:
message = '奖励不存在 The present does not exist.'
with Connect() as c:
c.execute(
'''select exists(select * from present where present_id=:a)''', {'a': present_id})
if c.fetchone() == (1,):
c.execute('''delete from present where present_id = :a''',
{'a': present_id})
c.execute('''delete from user_present where present_id =:a''', {
'a': present_id})
message = '删除成功 Successfully delete it.'
else:
message = '奖励不存在 The present does not exist.'
conn.commit()
conn.close()
return message
@@ -423,19 +402,16 @@ def add_one_redeem(code, redeem_type, items):
# 添加一个兑换码
message = None
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
c.execute(
'''select exists(select * from redeem where code=:a)''', {'a': code})
if c.fetchone() == (0,):
c.execute('''insert into redeem values(:a,:b,:c)''', {
'a': code, 'b': items, 'c': redeem_type})
message = '添加成功 Successfully add it.'
else:
message = '兑换码已存在 The redeem code exists.'
with Connect() as c:
c.execute(
'''select exists(select * from redeem where code=:a)''', {'a': code})
if c.fetchone() == (0,):
c.execute('''insert into redeem values(:a,:b,:c)''', {
'a': code, 'b': items, 'c': redeem_type})
message = '添加成功 Successfully add it.'
else:
message = '兑换码已存在 The redeem code exists.'
conn.commit()
conn.close()
return message
@@ -443,21 +419,19 @@ def add_some_random_redeem(amount, redeem_type, items):
# 随机生成一堆10位的兑换码
message = None
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
i = 1
while i <= amount:
code = random_str()
c.execute(
'''select exists(select * from redeem where code=:a)''', {'a': code})
if c.fetchone() == (0,):
c.execute('''insert into redeem values(:a,:b,:c)''',
{'a': code, 'b': items, 'c': redeem_type})
i += 1
with Connect() as c:
i = 1
while i <= amount:
code = random_str()
c.execute(
'''select exists(select * from redeem where code=:a)''', {'a': code})
if c.fetchone() == (0,):
c.execute('''insert into redeem values(:a,:b,:c)''',
{'a': code, 'b': items, 'c': redeem_type})
i += 1
message = '添加成功 Successfully add it.'
message = '添加成功 Successfully add it.'
conn.commit()
conn.close()
return message
@@ -465,19 +439,17 @@ def delete_one_redeem(code):
# 删除一个兑换码
message = None
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
c.execute(
'''select exists(select * from redeem where code=:a)''', {'a': code})
if c.fetchone() == (1,):
c.execute('''delete from redeem where code = :a''', {'a': code})
c.execute('''delete from user_redeem where code =:a''', {'a': code})
message = '删除成功 Successfully delete it.'
else:
message = '兑换码不存在 The redeem code does not exist.'
with Connect() as c:
c.execute(
'''select exists(select * from redeem where code=:a)''', {'a': code})
if c.fetchone() == (1,):
c.execute('''delete from redeem where code = :a''', {'a': code})
c.execute(
'''delete from user_redeem where code =:a''', {'a': code})
message = '删除成功 Successfully delete it.'
else:
message = '兑换码不存在 The redeem code does not exist.'
conn.commit()
conn.close()
return message

View File

@@ -49,6 +49,10 @@ def get_user(c, user_id):
if x[20]:
time_played = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(int(x[20])//1000))
if x[2] == '':
ban_flag = True
else:
ban_flag = False
r = {'name': x[1],
'user_id': user_id,
@@ -65,7 +69,8 @@ def get_user(c, user_id):
'time_played': time_played,
'clear_type': x[21],
'rating': x[22],
'ticket': x[26]
'ticket': x[26],
'ban_flag': ban_flag
}
return r