14 Commits
v2.3 ... 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
13 changed files with 1210 additions and 1018 deletions

View File

@@ -39,8 +39,8 @@ This procedure is mainly used for study and research, and shall not be used for
- 服务器日志 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
@@ -60,17 +60,18 @@ 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.3
- 适用于Arcaea 3.5.2版本 For Arcaea 3.5.2
### Version 2.3.2
- 适用于Arcaea 3.5.4版本 For Arcaea 3.5.4
- 更新了歌曲数据库 Update the song database.
- 新增服务器日志 Add server log.
- 优化了代码结构 Optimize the code structure.
- 修复了一些Bug提升服务器安全性 Fix some bugs and improve server security.
- 新增运行前关键性文件检查 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/Linux/Mac OS/Android
@@ -78,6 +79,7 @@ It is just so interesting. What it can do is under exploration.
- 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)
@@ -89,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

@@ -244,16 +244,36 @@ skill_id = ['gauge_easy', '', '', '', 'note_mirror', '', '', 'gauge_hard', 'frag
skill_id_uncap = ['', '', 'frags_kou', '', 'visual_ink', '', '', '', '', '', '', '', '', 'shirabe_entry_fee',
'', '', '', '', '', '', '', 'frags_yume', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
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

@@ -12,10 +12,10 @@
"items": [{
"id": "dataerror",
"type": "single",
"_id": "6046bab736651a07ebc537f3",
"_id": "606f9f5636651a07ebc541f3",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -24,10 +24,10 @@
"items": [{
"id": "yourvoiceso",
"type": "single",
"_id": "6046bab736651a07ebc53800",
"_id": "606f9f5636651a07ebc54201",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -36,10 +36,10 @@
"items": [{
"id": "crosssoul",
"type": "single",
"_id": "6046bab736651a07ebc5380d",
"_id": "606f9f5636651a07ebc5420e",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -48,10 +48,10 @@
"items": [{
"type": "single",
"id": "impurebird",
"_id": "6046bab736651a07ebc53801",
"_id": "606f9f5636651a07ebc541f4",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -60,7 +60,7 @@
"items": [{
"type": "single",
"id": "auxesia",
"_id": "6046bab736651a07ebc5380e",
"_id": "606f9f5636651a07ebc5420f",
"is_available": true
}],
"price": 100,
@@ -72,10 +72,10 @@
"items": [{
"type": "single",
"id": "modelista",
"_id": "6046bab736651a07ebc537f4",
"_id": "606f9f5636651a07ebc54202",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -84,10 +84,10 @@
"items": [{
"type": "single",
"id": "yozakurafubuki",
"_id": "6046bab736651a07ebc53802",
"_id": "606f9f5636651a07ebc541f5",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -96,10 +96,10 @@
"items": [{
"type": "single",
"id": "surrender",
"_id": "6046bab736651a07ebc5380f",
"_id": "606f9f5636651a07ebc54210",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -108,7 +108,7 @@
"items": [{
"type": "single",
"id": "metallicpunisher",
"_id": "6046bab736651a07ebc537f5",
"_id": "606f9f5636651a07ebc54203",
"is_available": true
}],
"price": 100,
@@ -118,7 +118,7 @@
"items": [{
"type": "single",
"id": "carminescythe",
"_id": "6046bab736651a07ebc53803",
"_id": "606f9f5636651a07ebc541f6",
"is_available": true
}],
"price": 100,
@@ -128,10 +128,10 @@
"items": [{
"type": "single",
"id": "bethere",
"_id": "6046bab736651a07ebc53810",
"_id": "606f9f5636651a07ebc54211",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -140,10 +140,10 @@
"items": [{
"type": "single",
"id": "callmyname",
"_id": "6046bab736651a07ebc537e9",
"_id": "606f9f5636651a07ebc5421c",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -152,10 +152,10 @@
"items": [{
"type": "single",
"id": "fallensquare",
"_id": "6046bab736651a07ebc537de",
"_id": "606f9f5636651a07ebc541e9",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -164,10 +164,10 @@
"items": [{
"type": "single",
"id": "dropdead",
"_id": "6046bab736651a07ebc53804",
"_id": "606f9f5636651a07ebc541f7",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -176,10 +176,10 @@
"items": [{
"type": "single",
"id": "alexandrite",
"_id": "6046bab736651a07ebc53811",
"_id": "606f9f5636651a07ebc54212",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -188,10 +188,10 @@
"items": [{
"type": "single",
"id": "astraltale",
"_id": "6046bab736651a07ebc537f7",
"_id": "606f9f5636651a07ebc54205",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -200,7 +200,7 @@
"items": [{
"type": "single",
"id": "phantasia",
"_id": "6046bab736651a07ebc537df",
"_id": "606f9f5636651a07ebc541ea",
"is_available": true
}],
"price": 100,
@@ -210,7 +210,7 @@
"items": [{
"type": "single",
"id": "empireofwinter",
"_id": "6046bab736651a07ebc53805",
"_id": "606f9f5636651a07ebc541f8",
"is_available": true
}],
"price": 100,
@@ -220,10 +220,10 @@
"items": [{
"type": "single",
"id": "libertas",
"_id": "6046bab736651a07ebc537eb",
"_id": "606f9f5636651a07ebc5421e",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -232,10 +232,10 @@
"items": [{
"type": "single",
"id": "dottodot",
"_id": "6046bab736651a07ebc537e0",
"_id": "606f9f5636651a07ebc541eb",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -244,10 +244,10 @@
"items": [{
"type": "single",
"id": "dreadnought",
"_id": "6046bab736651a07ebc537ec",
"_id": "606f9f5636651a07ebc5421f",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -256,10 +256,10 @@
"items": [{
"type": "single",
"id": "mirzam",
"_id": "6046bab736651a07ebc537e1",
"_id": "606f9f5636651a07ebc541ec",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -268,10 +268,10 @@
"items": [{
"type": "single",
"id": "heavenlycaress",
"_id": "6046bab736651a07ebc53807",
"_id": "606f9f5636651a07ebc541fa",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -280,10 +280,10 @@
"items": [{
"type": "single",
"id": "filament",
"_id": "6046bab736651a07ebc53814",
"_id": "606f9f5636651a07ebc54215",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -292,7 +292,7 @@
"items": [{
"type": "single",
"id": "avantraze",
"_id": "6046bab736651a07ebc537ed",
"_id": "606f9f5636651a07ebc54220",
"is_available": true
}],
"price": 100,
@@ -302,10 +302,10 @@
"items": [{
"type": "single",
"id": "battlenoone",
"_id": "6046bab736651a07ebc537fa",
"_id": "606f9f5636651a07ebc54208",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -314,7 +314,7 @@
"items": [{
"type": "single",
"id": "saikyostronger",
"_id": "6046bab736651a07ebc537e2",
"_id": "606f9f5636651a07ebc541ed",
"is_available": true
}],
"price": 100,
@@ -324,10 +324,10 @@
"items": [{
"type": "single",
"id": "izana",
"_id": "6046bab736651a07ebc53808",
"_id": "606f9f5636651a07ebc541fb",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -336,10 +336,10 @@
"items": [{
"type": "single",
"id": "einherjar",
"_id": "6046bab736651a07ebc53815",
"_id": "606f9f5636651a07ebc54216",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -348,10 +348,10 @@
"items": [{
"type": "single",
"id": "laqryma",
"_id": "6046bab736651a07ebc537ee",
"_id": "606f9f5636651a07ebc54221",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -360,10 +360,10 @@
"items": [{
"type": "single",
"id": "amygdata",
"_id": "6046bab736651a07ebc537fb",
"_id": "606f9f5636651a07ebc54209",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -372,10 +372,10 @@
"items": [{
"type": "single",
"id": "altale",
"_id": "6046bab736651a07ebc537e3",
"_id": "606f9f5636651a07ebc541ee",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -384,10 +384,10 @@
"items": [{
"type": "single",
"id": "feelssoright",
"_id": "6046bab736651a07ebc537ef",
"_id": "606f9f5636651a07ebc54222",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -396,7 +396,7 @@
"items": [{
"type": "single",
"id": "scarletcage",
"_id": "6046bab736651a07ebc537fc",
"_id": "606f9f5636651a07ebc5420a",
"is_available": true
}],
"price": 100,
@@ -406,7 +406,7 @@
"items": [{
"type": "single",
"id": "teriqma",
"_id": "6046bab736651a07ebc537e4",
"_id": "606f9f5636651a07ebc541ef",
"is_available": true
}],
"price": 100,
@@ -416,10 +416,10 @@
"items": [{
"type": "single",
"id": "mahoroba",
"_id": "6046bab736651a07ebc5380a",
"_id": "606f9f5636651a07ebc541fd",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -428,10 +428,10 @@
"items": [{
"type": "single",
"id": "badtek",
"_id": "6046bab736651a07ebc537f0",
"_id": "606f9f5636651a07ebc54223",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -440,7 +440,7 @@
"items": [{
"type": "single",
"id": "maliciousmischance",
"_id": "6046bab736651a07ebc53817",
"_id": "606f9f5636651a07ebc54218",
"is_available": true
}],
"price": 100,
@@ -450,7 +450,7 @@
"items": [{
"type": "single",
"id": "buchigireberserker",
"_id": "6046bab736651a07ebc537e5",
"_id": "606f9f5636651a07ebc541f0",
"is_available": true
}],
"price": 100,
@@ -460,10 +460,10 @@
"items": [{
"type": "single",
"id": "galaxyfriends",
"_id": "6046bab736651a07ebc5380b",
"_id": "606f9f5636651a07ebc541fe",
"is_available": true
}],
"price": 50,
"price": 100,
"orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
@@ -472,7 +472,7 @@
"items": [{
"type": "single",
"id": "xeraphinite",
"_id": "6046bab736651a07ebc53818",
"_id": "606f9f5636651a07ebc54219",
"is_available": true
}],
"orig_price": 100,
@@ -482,7 +482,7 @@
"items": [{
"type": "single",
"id": "xanatos",
"_id": "6046bab736651a07ebc537f1",
"_id": "606f9f5636651a07ebc54224",
"is_available": true
}],
"price": 100,
@@ -492,7 +492,7 @@
"items": [{
"type": "single",
"id": "attraqtia",
"_id": "6046bab736651a07ebc537ff",
"_id": "606f9f5636651a07ebc5420d",
"is_available": true
}],
"orig_price": 100,
@@ -502,7 +502,17 @@
"items": [{
"type": "single",
"id": "gimmedablood",
"_id": "6046bab736651a07ebc537e7",
"_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

@@ -1 +0,0 @@

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,6 +523,7 @@ 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)
@@ -560,6 +571,11 @@ def main():
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:
error = server.arcdownload.initialize_songfile()
@@ -570,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,7 +199,7 @@ 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"],
"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),
"characters": characters,
@@ -225,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,
@@ -237,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

@@ -8,12 +8,35 @@ class Config():
主机的地址和端口号
Host and port of your server
'''
HOST = '192.168.1.105'
HOST = '192.168.1.101'
PORT = '80'
'''
--------------------
'''
'''
--------------------
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后台管理页面的用户名和密码
@@ -36,6 +59,17 @@ class Config():
--------------------
'''
'''
--------------------
歌曲下载地址前缀,留空则自动获取
Song download address prefix
If left blank, it will be obtained automatically.
'''
DOWNLOAD_LINK_PREFIX = '' # http://***.com/download/
'''
--------------------
'''
'''
--------------------
玩家歌曲下载的24小时次数限制每个文件算一次
@@ -75,3 +109,23 @@ class Config():
'''
--------------------
'''
'''
--------------------
用户注册时的默认记忆源点数量
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
'''
--------------------
'''