Skip to content

Commit

Permalink
create dgp tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterain98 committed Sep 8, 2023
1 parent f91e5dd commit f771c33
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,3 @@ cython_debug/
.idea/
*.pem
test.py
dgp_tools.py
run.sh
14 changes: 14 additions & 0 deletions dgp_tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import requests
import json


def get_log(device_id: str) -> dict | None:
url = f"https://homa.snapgenshin.com/HutaoLog/ByDeviceId?id={device_id}"
headers = {
"authority": "dgp-bot"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
return json.loads(response.text)
else:
return None
18 changes: 18 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Docker Image Settings
imageName=dgp-github-bot
containerName=DGP-GitHub-Bot
imageVersion=1.9
externalPort=3524
internalPort=8080

oldContainer=`docker ps -a| grep ${containerName} | head -1|awk '{print $1}' `
echo Delete old container...
docker rm $oldContainer -f
echo Delete success

docker build -f Dockerfile -t $imageName:$imageVersion .
docker run -d -itp $externalPort:$internalPort \
-v $(pwd)/.env:/app/.env \
--restart=always \
--name="$containerName" \
$imageName:$imageVersion

0 comments on commit f771c33

Please sign in to comment.