Skip to content

Commit

Permalink
fix:森空岛签到无法签到
Browse files Browse the repository at this point in the history
  • Loading branch information
EightyDollars committed Oct 2, 2023
1 parent d37a6ce commit c4131ff
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 44 deletions.
26 changes: 25 additions & 1 deletion arknights_mower/solvers/skland.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ def __init__(self, skland_info):
}

self.request_header = {
"user-agent": "Skland/1.0.1 (com.hypergryph.skland; build:100001014; Android 25; ) Okhttp/4.11.0",
"user-agent": "Skland/1.0.1 (com.hypergryph.skland; build:100001014; Android 33; ) Okhttp/4.11.0",
"cred": '',
"vName": "1.0.1",
"vCode": "100001014",
'Accept-Encoding': 'gzip',
'Connection': 'close',
"dId": "de9759a5afaa634f",
"platform": "1"
}

self.get_award = {}
Expand Down Expand Up @@ -176,3 +183,20 @@ def get_record(self, account):
return False

return False

def test_connect(self):
res = []
for item in self.account:
data = {"phone": item['phone'], "password": item['password']}
response = requests.post(headers=self.request_header, url=self.url.get("token_by_phone_password"),
data=data)

response_json = self.respone_to_json(response)
temp_res = {
"account": item['phone'],
'msg': response_json['msg']
}
res.append(temp_res)

logger.info(res)

110 changes: 70 additions & 40 deletions server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python3
import requests

from arknights_mower.solvers import record
from arknights_mower.utils.conf import load_conf, save_conf, load_plan, write_plan
from arknights_mower.__main__ import main
Expand Down Expand Up @@ -27,17 +29,14 @@

import pathlib


mimetypes.add_type("text/html", ".html")
mimetypes.add_type("text/css", ".css")
mimetypes.add_type("application/javascript", ".js")


app = Flask(__name__, static_folder="dist", static_url_path="")
sock = Sock(app)
CORS(app)


conf = {}
plan = {}
mower_process = None
Expand Down Expand Up @@ -100,27 +99,27 @@ def load_plan_from_json():
def operator_list():
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
with open(
os.path.join(
sys._MEIPASS,
"arknights_mower",
"__init__",
"data",
"agent.json",
),
"r",
encoding="utf8",
os.path.join(
sys._MEIPASS,
"arknights_mower",
"__init__",
"data",
"agent.json",
),
"r",
encoding="utf8",
) as f:
return json.load(f)
else:
with open(
os.path.join(
os.getcwd(),
"arknights_mower",
"data",
"agent.json",
),
"r",
encoding="utf8",
os.path.join(
os.getcwd(),
"arknights_mower",
"data",
"agent.json",
),
"r",
encoding="utf8",
) as f:
return json.load(f)

Expand All @@ -129,27 +128,27 @@ def operator_list():
def shop_list():
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
with open(
os.path.join(
sys._MEIPASS,
"arknights_mower",
"__init__",
"data",
"shop.json",
),
"r",
encoding="utf8",
os.path.join(
sys._MEIPASS,
"arknights_mower",
"__init__",
"data",
"shop.json",
),
"r",
encoding="utf8",
) as f:
return json.load(f)
else:
with open(
os.path.join(
os.getcwd(),
"arknights_mower",
"data",
"shop.json",
),
"r",
encoding="utf8",
os.path.join(
os.getcwd(),
"arknights_mower",
"data",
"shop.json",
),
"r",
encoding="utf8",
) as f:
return json.load(f)

Expand Down Expand Up @@ -294,9 +293,9 @@ def get_maa_adb_version():
def get_maa_conn_presets():
try:
with open(
os.path.join(conf["maa_path"], "resource", "config.json"),
"r",
encoding="utf-8",
os.path.join(conf["maa_path"], "resource", "config.json"),
"r",
encoding="utf-8",
) as f:
presets = [i["configName"] for i in json.load(f)["connection"]]
except:
Expand All @@ -323,3 +322,34 @@ def test_email():
except Exception as e:
return "邮件发送失败!\n" + str(e)
return "邮件发送成功!"


@app.route("/check-skland")
@require_token
def test_skland():
skland_info=[]
skland_info = conf['skland_info']

request_header = {
"user-agent": "Skland/1.0.1 (com.hypergryph.skland; build:100001014; Android 33; ) Okhttp/4.11.0",
"cred": '',
"vName": "1.0.1",
"vCode": "100001014",
'Accept-Encoding': 'gzip',
'Connection': 'close',
"dId": "de9759a5afaa634f",
"platform": "1"
}
res = []
for item in skland_info:
data = {"phone": item['account'], "password": item['password']}
response = requests.post(headers=request_header, url="https://as.hypergryph.com/user/auth/v1/token_by_phone_password",
data=data)
response_json = json.loads(response.text)
temp_res = {
"account": item['account'],
'msg': response_json['msg']
}
res.append(temp_res)

return res
30 changes: 28 additions & 2 deletions ui/src/components/SKLand.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
<script setup>
import { storeToRefs } from 'pinia'
import { inject, ref } from 'vue'
const axios = inject('axios')
import { useConfigStore } from '@/stores/config'
const store = useConfigStore()
import { storeToRefs } from 'pinia'
const { skland_enable, skland_info } = storeToRefs(store)
function add_account() {
return {
isCheck: true,
account: '',
password: ''
}
}
const maa_msg = ref('')
async function test_maa() {
maa_msg.value = '正在测试……'
const response = await axios.get(`${import.meta.env.VITE_HTTP_URL}/check-skland`)
maa_msg.value = response.data
}
</script>
<template>
<n-card>
<template #header>
<n-checkbox v-model:checked="skland_enable" disabled>
<n-checkbox v-model:checked="skland_enable">
<div class="card-title">森空岛签到</div>
</n-checkbox>
</template>
Expand All @@ -42,6 +57,10 @@ function add_account() {
</div>
</template>
</n-dynamic-input>
<div class="misc-container">
<n-button @click="test_maa">测试设置</n-button>
<div>{{ maa_msg }}</div>
</div>
</n-card>
</template>
Expand All @@ -50,4 +69,11 @@ function add_account() {
font-weight: 500;
font-size: 18px;
}
.misc-container {
margin-top: 12px;
display: flex;
align-items: center;
gap: 12px;
}
</style>
4 changes: 3 additions & 1 deletion ui/src/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,11 @@ function render_label(option) {
</n-card>
</div>
<div><maa-basic /></div>
<div><SKLand /></div>
<div><email /></div>

</div>
<!-- <SKLand /> -->

<div class="grid-right">
<div><clue /></div>

Expand Down

0 comments on commit c4131ff

Please sign in to comment.