Merge pull request 'testing_slash を testing にマージ' (#18) from testing_slash into testing

Reviewed-on: #18
This commit is contained in:
suti7yk5032 2024-09-29 01:07:40 +09:00
commit 7960315a40
5 changed files with 1670 additions and 17 deletions

View file

@ -334,15 +334,29 @@ def register():
with open(onetime_config_path, "r") as r:
onetime_config = json.load(r)
if onetime_password == onetime_config["onetime"]["pc_register"]:
if onetime_password == onetime_config["onetime"]["pc_register"]["password"]:
register_result = auth.register(pc_number=pc_number, pc_uuid=pc_uuid)
if register_result["result"] == 0:
pc_token = register_result["output_dict"]["pc_token"]
master_password = register_result["output_dict"]["master_password"]
master_password_hash = register_result["output_dict"]["master_password_hash"]
onetime_config["onetime"]["pc_register"] = None
onetime_config["onetime"]["pc_register"]["current_count"] += 1
if onetime_config["onetime"]["pc_register"]["current_count"] == onetime_config["onetime"]["pc_register"]["max_count"]:
onetime_config["onetime"]["pc_register"]["password"] = None
with open(onetime_config_path, "w") as w:
json.dump(onetime_config, w, indent=4)
return jsonify({'message': 'ok', 'pc_token': pc_token, 'master_password': master_password, 'master_password_hash': master_password_hash}), 200
else:
with open(onetime_config_path, "w") as w:
json.dump(onetime_config, w, indent=4)
return jsonify({'message': 'ok', 'pc_token': pc_token, 'master_password': master_password, 'master_password_hash': master_password_hash}), 200
elif register_result["result"] == 1:
if register_result["about"] == "exist":
return jsonify({'message': 'exist'}), 401
else:
return jsonify({'message': 'damedesu'}), 401
else:
return jsonify({'message': 'damedesu'}), 401
else:
@ -410,22 +424,37 @@ def device_register():
device_register = auth.device_register(mode="keyboard", number=number, device_instance_path=device_instance_path, device_name=device_name)
if device_register["result"] == 0:
print(f"キーボード {number} 番の登録処理は成功しました.")
onetime_config["onetime"]["device_register"]["current_count"] += 1
if onetime_config["onetime"]["device_register"]["current_count"] == onetime_config["onetime"]["device_register"]["max_count"]:
onetime_config["onetime"]["device_register"] = None
with open(onetime_config_path, "w") as w:
json.dump(onetime_config, w, indent=4)
return jsonify({'message': 'ok'}), 200
else:
with open(onetime_config_path, "w") as w:
json.dump(onetime_config, w, indent=4)
return jsonify({'message': 'ok'}), 200
else:
print(f"キーボード {number} 番の登録処理は失敗しました.")
return jsonify({'message': 'error'}), 500
elif mode == "mouse":
print("マウスの登録処理を開始...")
device_register = auth.device_register(mode="mouse", number=number, device_instance_path=device_instance_path, device_name=device_name)
if device_register["result"] == 0:
print(f"マウス {number} 番の登録処理は成功しました.")
onetime_config["onetime"]["device_register"]["current_count"] += 1
if onetime_config["onetime"]["device_register"]["current_count"] == onetime_config["onetime"]["device_register"]["max_count"]:
onetime_config["onetime"]["device_register"] = None
with open(onetime_config_path, "w") as w:
json.dump(onetime_config, w, indent=4)
return jsonify({'message': 'ok'}), 200
else:
with open(onetime_config_path, "w") as w:
json.dump(onetime_config, w, indent=4)
return jsonify({'message': 'ok'}), 200
else:
print(f"マウス {number} 番の登録処理は失敗しました.")
return jsonify({'message': 'error'}), 500

View file

@ -284,7 +284,7 @@ class Lock(customtkinter.CTkToplevel):
self.msg_subtitle_1 = customtkinter.CTkLabel(self.msg_subtitle_frame, text='サインインするには、Discordのダイレクトメッセージに送信された\nパスワードを入力してください。', font=self.general_font, justify="left")
self.msg_subtitle_1.grid(row=0, column=0, padx=10, sticky="ew")
self.msg_subtitle_2 = customtkinter.CTkLabel(self.msg_subtitle_frame, text='※ パスワードの有効期限は23:59までです。', font=self.general_small_font, justify="left")
self.msg_subtitle_2 = customtkinter.CTkLabel(self.msg_subtitle_frame, text='※ パスワードの有効期限は発行から5分間です。', font=self.general_small_font, justify="left")
self.msg_subtitle_2.grid(row=1, column=0, padx=10, sticky="w")
self.input_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color='transparent')

1605
dislocker_slash.py Normal file

File diff suppressed because it is too large Load diff

View file

@ -12,4 +12,5 @@ tar -xf %dir%\dislocker_client.zip -C %dir%\temp_ds
mkdir C:\ProgramData\Dislocker
xcopy /e %dir%\temp_ds C:\ProgramData\Dislocker
rmdir /s /q %dir%\temp_ds
del %dir%\dislocker_client.zip
C:\ProgramData\Dislocker\setup.cmd

18
script/update_online.cmd Normal file
View file

@ -0,0 +1,18 @@
@echo off
set dir=%~dp0
cd %dir%
set download_url=""
curl -L %download_url% -o %dir%\dislocker_client.zip
mkdir %dir%\temp_ds
tar -xf %dir%\dislocker_client.zip -C %dir%\temp_ds
rmdir /s /q C:\ProgramData\Dislocker\_internal
xcopy /e %dir%\temp_ds\_internal C:\ProgramData\Dislocker\_internal
xcopy /Y %dir%\temp_ds\dislocker_client.exe C:\ProgramData\Dislocker\dislocker_client.exe
rmdir /s /q %dir%\temp_ds
del %dir%\dislocker_client.zip
echo アップデート完了。Defenderの警告を消すため、一度起動しておいてください。
pause