[+] More instructions
This commit is contained in:
@@ -7,13 +7,28 @@ Segatools 读卡器前端
|
||||
# 装
|
||||
|
||||
```
|
||||
git clone https://github.com/MaigoLabs/AimeWeb
|
||||
cd AimeWeb
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
# 配
|
||||
|
||||
编辑 `src/main.py` 文件
|
||||
|
||||
```py
|
||||
AIME_PATH = "aime.txt" # segatools aimePath
|
||||
KEY = 0x0D # segatools card scan key
|
||||
PORT = 8249 # HTTP Port
|
||||
```
|
||||
|
||||
# 跑
|
||||
|
||||
```
|
||||
venv/bin/python3 src/main.py
|
||||
```
|
||||
|
||||
# 用
|
||||
|
||||
浏览器打开 `http://{LAN ip}:8249`
|
||||
|
||||
+9
-3
@@ -10,6 +10,12 @@ from starlette.responses import HTMLResponse
|
||||
|
||||
from vk import press_key, release_key
|
||||
|
||||
|
||||
AIME_PATH = "aime.txt" # segatools aimePath
|
||||
KEY = 0x0D # segatools card scan key
|
||||
PORT = 8249 # HTTP Port
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# CORS
|
||||
@@ -22,7 +28,7 @@ app.add_middleware(
|
||||
)
|
||||
|
||||
# Configuration
|
||||
PATH = Path('aime.txt')
|
||||
PATH = Path(AIME_PATH)
|
||||
AUDIO_EFFECT = Path(__file__).parent / 'audio/mixkit-gaming-lock-2848.wav'
|
||||
|
||||
HTML = Path(__file__).parent.parent / "web/dist/index.html"
|
||||
@@ -58,9 +64,9 @@ def scan(uid: str):
|
||||
winsound.PlaySound(str(AUDIO_EFFECT), winsound.SND_FILENAME)
|
||||
|
||||
# Simulate key press
|
||||
press_key()
|
||||
press_key(KEY)
|
||||
time.sleep(5)
|
||||
release_key()
|
||||
release_key(KEY)
|
||||
|
||||
return {"uid": uid}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import ctypes
|
||||
|
||||
# Virtual-Key codes
|
||||
VK = 0x0D
|
||||
|
||||
|
||||
def press_key(vk_code=VK):
|
||||
def press_key(vk_code):
|
||||
scan_code = ctypes.windll.user32.MapVirtualKeyA(vk_code, 0)
|
||||
ctypes.windll.user32.keybd_event(vk_code, scan_code, 0, 0)
|
||||
|
||||
|
||||
def release_key(vk_code=VK):
|
||||
def release_key(vk_code):
|
||||
scan_code = ctypes.windll.user32.MapVirtualKeyA(vk_code, 0)
|
||||
ctypes.windll.user32.keybd_event(vk_code, scan_code, 0x0002, 0)
|
||||
|
||||
Reference in New Issue
Block a user