-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathqoder_reset_gui.py
More file actions
2792 lines (2445 loc) · 127 KB
/
Copy pathqoder_reset_gui.py
File metadata and controls
2792 lines (2445 loc) · 127 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""
Qoder Reset Tool - 现代化GUI版本
使用PyQt5实现,完全按照用户原型图设计
"""
import os
import sys
import json
import uuid
import shutil
import hashlib
import subprocess
import webbrowser
import platform
import random
from pathlib import Path
from datetime import datetime
try:
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
except ImportError:
print("错误: 未安装PyQt5")
print("请运行: pip install PyQt5")
sys.exit(1)
class QoderResetGUI(QMainWindow):
def __init__(self):
super().__init__()
self.current_language = 'zh' # 默认中文
self.init_translations()
self.init_ui()
def init_translations(self):
"""初始化多语言字典"""
self.translations = {
'zh': { # 中文
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free主要用于重置Qoder应用程序的用户身份信息',
'operation_area': '操作区域:',
'one_click_config': '一键修改配置',
'close_qoder': '关闭Qoder',
'reset_machine_id': '重置机器ID',
'reset_telemetry': '重置遥测数据',
'deep_identity_clean': '深度身份清理',
'login_identity_clean': '清理登录身份',
'hardware_fingerprint_reset': '硬件指纹重置',
'advanced_options': '高级选项',
'preserve_chat': '保留对话记录',
'operation_log': '操作日志:',
'clear_log': '清空日志',
'github': 'Github',
'language': '语言',
# 日志消息
'tool_started': 'Qoder-Free 重置工具已启动',
'log_cleared': '日志已清空',
'qoder_running': 'Qoder正在运行',
'qoder_not_running': 'Qoder未运行',
'qoder_directory_exists': 'Qoder目录存在',
'machine_id': '机器ID',
'telemetry_machine_id': '遥测机器ID',
'device_id': '设备ID',
'cache_directories_found': '个缓存目录',
'chat_directories_found': '个对话相关目录',
'identity_files_found': '个身份识别文件',
'status_check_complete': '状态检查完成,可以开始操作',
# 对话框消息
'qoder_detected_running': '检测到 Qoder 正在运行',
'please_close_qoder': '请手动关闭 Qoder 应用程序',
'confirm_one_click': '确认一键修改',
'confirm_deep_clean': '确认深度清理',
'confirm_login_clean': '确认清理登录身份',
'operation_complete': '操作完成',
'operation_failed': '操作失败',
'error': '错误',
'success': '成功',
'warning': '警告',
'status_check': '状态检查'
},
'en': { # English
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free is mainly used to reset user identity information of Qoder application',
'operation_area': 'Operation Area:',
'one_click_config': 'One-Click Configuration',
'close_qoder': 'Close Qoder',
'reset_machine_id': 'Reset Machine ID',
'reset_telemetry': 'Reset Telemetry',
'deep_identity_clean': 'Deep Identity Cleanup',
'login_identity_clean': 'Clean Login Identity',
'hardware_fingerprint_reset': 'Hardware Reset',
'advanced_options': 'Advanced Options',
'preserve_chat': 'Preserve Chat History',
'operation_log': 'Operation Log:',
'clear_log': 'Clear Log',
'github': 'Github',
'language': 'Language',
# Log messages
'tool_started': 'Qoder-Free reset tool started',
'log_cleared': 'Log cleared',
'qoder_running': 'Qoder is running',
'qoder_not_running': 'Qoder is not running',
'qoder_directory_exists': 'Qoder directory exists',
'machine_id': 'Machine ID',
'telemetry_machine_id': 'Telemetry Machine ID',
'device_id': 'Device ID',
'cache_directories_found': 'cache directories found',
'chat_directories_found': 'chat-related directories found',
'identity_files_found': 'identity files found',
'status_check_complete': 'Status check completed, ready to operate',
# Dialog messages
'qoder_detected_running': 'Qoder Detected Running',
'please_close_qoder': 'Please close Qoder application manually',
'confirm_one_click': 'Confirm One-Click Reset',
'confirm_deep_clean': 'Confirm Deep Cleanup',
'confirm_login_clean': 'Confirm Login Identity Cleanup',
'operation_complete': 'Operation Complete',
'operation_failed': 'Operation Failed',
'error': 'Error',
'success': 'Success',
'warning': 'Warning',
'status_check': 'Status Check'
},
'ru': { # Русский
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free в основном используется для сброса пользовательской информации приложения Qoder',
'operation_area': 'Область операций:',
'one_click_config': 'Одним кликом',
'close_qoder': 'Закрыть Qoder',
'reset_machine_id': 'Сбросить ID машины',
'reset_telemetry': 'Сбросить телеметрию',
'deep_identity_clean': 'Глубокая очистка',
'login_identity_clean': 'Очистить вход',
'hardware_fingerprint_reset': 'Сброс железа',
'advanced_options': 'Дополнительно',
'preserve_chat': 'Сохранить чат',
'operation_log': 'Журнал операций:',
'clear_log': 'Очистить журнал',
'github': 'Github',
'language': 'Язык',
# Log messages
'tool_started': 'Инструмент сброса Qoder-Free запущен',
'log_cleared': 'Журнал очищен',
'qoder_running': 'Qoder запущен',
'qoder_not_running': 'Qoder не запущен',
'qoder_directory_exists': 'Папка Qoder существует',
'machine_id': 'ID машины',
'telemetry_machine_id': 'ID машины телеметрии',
'device_id': 'ID устройства',
'cache_directories_found': 'папок кеша найдено',
'chat_directories_found': 'папок чата найдено',
'identity_files_found': 'файлов идентификации найдено',
'status_check_complete': 'Проверка статуса завершена, готов к работе',
# Dialog messages
'qoder_detected_running': 'Обнаружен запущенный Qoder',
'please_close_qoder': 'Пожалуйста, закройте приложение Qoder вручную',
'confirm_one_click': 'Подтвердить сброс одним кликом',
'confirm_deep_clean': 'Подтвердить глубокую очистку',
'confirm_login_clean': 'Подтвердить очистку входа',
'operation_complete': 'Операция завершена',
'operation_failed': 'Операция не удалась',
'error': 'Ошибка',
'success': 'Успех',
'warning': 'Предупреждение',
'status_check': 'Проверка статуса'
},
'pt-br': { # Português (Brasil)
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free é principalmente usado para redefinir as informações de identidade do usuário do aplicativo Qoder',
'operation_area': 'Área de Operações:',
'one_click_config': 'Configuração com um clique',
'close_qoder': 'Fechar Qoder',
'reset_machine_id': 'Redefinir ID da Máquina',
'reset_telemetry': 'Redefinir Telemetria',
'deep_identity_clean': 'Limpeza Profunda de Identidade',
'login_identity_clean': 'Limpar Login',
'hardware_fingerprint_reset': 'Reset de Hardware',
'advanced_options': 'Opções Avançadas',
'preserve_chat': 'Preservar Histórico do chat',
'operation_log': 'Log de Operações:',
'clear_log': 'Limpar Log',
'github': 'Github',
'language': 'Idioma',
# Log messages
'tool_started': 'Ferramenta de redefinição Qoder-Free iniciada',
'log_cleared': 'Log limpo',
'qoder_running': 'Qoder está em execução',
'qoder_not_running': 'Qoder não está em execução',
'qoder_directory_exists': 'Diretório Qoder existe',
'machine_id': 'ID da Máquina',
'telemetry_machine_id': 'ID da Máquina de Telemetria',
'device_id': 'ID do Dispositivo',
'cache_directories_found': 'diretórios de cache encontrados',
'chat_directories_found': 'diretórios relacionados ao chat encontrados',
'identity_files_found': 'arquivos de identidade encontrados',
'status_check_complete': 'Verificação de status concluída, pronto para operar',
# Dialog messages
'qoder_detected_running': 'Qoder Detectado em Execução',
'please_close_qoder': 'Por favor, feche o aplicativo Qoder manualmente',
'confirm_one_click': 'Confirmar Redefinição com um clique',
'confirm_deep_clean': 'Confirmar Limpeza Profunda',
'confirm_login_clean': 'Confirmar Limpeza de Identidade de Login',
'operation_complete': 'Operação Concluída',
'operation_failed': 'Operação Falhou',
'error': 'Erro',
'success': 'Sucesso',
'warning': 'Aviso',
'status_check': 'Verificação de Status'
}
}
def tr(self, key):
"""获取当前语言的翻译文本"""
return self.translations.get(self.current_language, {}).get(key, key)
def init_ui(self):
"""初始化用户界面"""
self.setWindowTitle(self.tr('window_title'))
self.setFixedSize(800, 1000)
self.setStyleSheet("background-color: white;")
# 创建中央部件
central_widget = QWidget()
self.setCentralWidget(central_widget)
# 创建主布局
main_layout = QVBoxLayout(central_widget)
main_layout.setContentsMargins(40, 30, 40, 30)
main_layout.setSpacing(20)
# 添加右上角语言切换组件
top_layout = QHBoxLayout()
top_layout.addStretch() # 推到右侧
# 语言标签
lang_label = QLabel(self.tr('language') + ":")
lang_label.setStyleSheet("""
QLabel {
font-size: 11px;
color: #666666;
margin-right: 5px;
}
""")
top_layout.addWidget(lang_label)
# 语言下拉框
self.language_combo = QComboBox()
self.language_combo.addItems(['中文', 'English', 'Русский', 'Português (BR)'])
self.language_combo.setFixedSize(90, 25)
self.language_combo.setStyleSheet("""
QComboBox {
background-color: white;
border: 1px solid #dadce0;
border-radius: 3px;
padding: 2px 8px;
font-size: 10px;
color: #333333;
}
QComboBox::drop-down {
border: none;
width: 18px;
}
QComboBox::down-arrow {
image: none;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid #666;
margin-top: 2px;
}
QComboBox QAbstractItemView {
background-color: white;
border: 1px solid #dadce0;
selection-background-color: #e8f0fe;
font-size: 10px;
}
""")
self.language_combo.currentTextChanged.connect(self.change_language)
top_layout.addWidget(self.language_combo)
main_layout.addLayout(top_layout)
# 1. 标题
self.title_label = QLabel(self.tr('window_title'))
self.title_label.setAlignment(Qt.AlignCenter)
self.title_label.setStyleSheet("""
QLabel {
font-size: 24px;
font-weight: bold;
color: black;
margin-bottom: 10px;
}
""")
main_layout.addWidget(self.title_label)
# 2. 说明文字
self.intro_label = QLabel(self.tr('intro_text'))
self.intro_label.setAlignment(Qt.AlignCenter)
self.intro_label.setStyleSheet("""
QLabel {
font-size: 12px;
color: #666666;
margin-bottom: 20px;
}
""")
main_layout.addWidget(self.intro_label)
# 3. 操作区域标题
self.operation_title = QLabel(self.tr('operation_area'))
self.operation_title.setStyleSheet("""
QLabel {
font-size: 14px;
font-weight: bold;
color: black;
margin-bottom: 10px;
}
""")
main_layout.addWidget(self.operation_title)
# 4. 蓝色横幅按钮
self.one_click_btn = QPushButton(self.tr('one_click_config'))
self.one_click_btn.setFixedSize(300, 40) # 设置固定宽度300px,高度40px
self.one_click_btn.setStyleSheet("""
QPushButton {
background-color: #4285f4;
color: white;
font-size: 14px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #3367d6;
}
QPushButton:pressed {
background-color: #2851a3;
}
""")
self.one_click_btn.clicked.connect(self.one_click_reset)
# 将按钮居中显示
button_center_layout = QHBoxLayout()
button_center_layout.addStretch()
button_center_layout.addWidget(self.one_click_btn)
button_center_layout.addStretch()
main_layout.addLayout(button_center_layout)
# 5. 四个操作按钮(扩展为2x2布局)
button_layout = QVBoxLayout()
# 第一行按钮
button_row1 = QHBoxLayout()
button_row1.setSpacing(15)
# 关闭Qoder按钮 (红色)
self.close_qoder_btn = QPushButton(self.tr('close_qoder'))
self.close_qoder_btn.setFixedSize(150, 40)
self.close_qoder_btn.setStyleSheet("""
QPushButton {
background-color: #ea4335;
color: white;
font-size: 12px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #d33b2c;
}
QPushButton:pressed {
background-color: #b52d20;
}
""")
self.close_qoder_btn.clicked.connect(self.close_qoder)
button_row1.addWidget(self.close_qoder_btn)
# 重置机器ID按钮 (蓝色)
self.reset_machine_id_btn = QPushButton(self.tr('reset_machine_id'))
self.reset_machine_id_btn.setFixedSize(150, 40)
self.reset_machine_id_btn.setStyleSheet("""
QPushButton {
background-color: #4285f4;
color: white;
font-size: 12px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #3367d6;
}
QPushButton:pressed {
background-color: #2851a3;
}
""")
self.reset_machine_id_btn.clicked.connect(self.reset_machine_id)
button_row1.addWidget(self.reset_machine_id_btn)
button_layout.addLayout(button_row1)
# 第二行按钮
button_row2 = QHBoxLayout()
button_row2.setSpacing(15)
# 重置遥测数据按钮 (蓝色)
self.reset_telemetry_btn = QPushButton(self.tr('reset_telemetry'))
self.reset_telemetry_btn.setFixedSize(150, 40)
self.reset_telemetry_btn.setStyleSheet("""
QPushButton {
background-color: #4285f4;
color: white;
font-size: 12px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #3367d6;
}
QPushButton:pressed {
background-color: #2851a3;
}
""")
self.reset_telemetry_btn.clicked.connect(self.reset_telemetry)
button_row2.addWidget(self.reset_telemetry_btn)
# 深度身份清理按钮 (橙色,新增)
self.deep_clean_btn = QPushButton(self.tr('deep_identity_clean'))
self.deep_clean_btn.setFixedSize(150, 40)
self.deep_clean_btn.setStyleSheet("""
QPushButton {
background-color: #ff9800;
color: white;
font-size: 12px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #f57c00;
}
QPushButton:pressed {
background-color: #e65100;
}
""")
self.deep_clean_btn.clicked.connect(self.deep_identity_cleanup)
button_row2.addWidget(self.deep_clean_btn)
# 第三行按钮(新增)
button_row3 = QHBoxLayout()
button_row3.setSpacing(15)
# 清理登录身份按钮 (紫色,新增)
self.login_clean_btn = QPushButton(self.tr('login_identity_clean'))
self.login_clean_btn.setFixedSize(150, 40)
self.login_clean_btn.setStyleSheet("""
QPushButton {
background-color: #673ab7;
color: white;
font-size: 12px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #5e35b1;
}
QPushButton:pressed {
background-color: #512da8;
}
""")
self.login_clean_btn.clicked.connect(self.login_identity_cleanup)
button_row3.addWidget(self.login_clean_btn)
# 硬件指纹重置按钮(绿色,新增)
self.hardware_reset_btn = QPushButton(self.tr('hardware_fingerprint_reset'))
self.hardware_reset_btn.setFixedSize(150, 40)
self.hardware_reset_btn.setStyleSheet("""
QPushButton {
background-color: #4caf50;
color: white;
font-size: 12px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #45a049;
}
QPushButton:pressed {
background-color: #3d8b40;
}
""")
self.hardware_reset_btn.clicked.connect(self.hardware_fingerprint_reset)
button_row3.addWidget(self.hardware_reset_btn)
button_layout.addLayout(button_row3)
main_layout.addLayout(button_layout)
# 5.5. 保留对话记录勾选框
self.preserve_chat_checkbox = QCheckBox(self.tr('preserve_chat'))
self.preserve_chat_checkbox.setChecked(True) # 默认勾选
self.preserve_chat_checkbox.setStyleSheet("""
QCheckBox {
color: black;
font-size: 12px;
font-weight: bold;
spacing: 8px;
}
QCheckBox::indicator {
width: 16px;
height: 16px;
border: 2px solid #4285f4;
border-radius: 3px;
background-color: white;
}
QCheckBox::indicator:checked {
background-color: #4285f4;
border: 2px solid #4285f4;
}
QCheckBox::indicator:checked:hover {
background-color: #3367d6;
border: 2px solid #3367d6;
}
""")
checkbox_layout = QHBoxLayout()
checkbox_layout.addWidget(self.preserve_chat_checkbox)
checkbox_layout.addStretch()
main_layout.addLayout(checkbox_layout)
# 6. 操作日志区域
self.log_title = QLabel(self.tr('operation_log'))
self.log_title.setStyleSheet("""
QLabel {
font-size: 14px;
font-weight: bold;
color: black;
margin-top: 10px;
margin-bottom: 10px;
}
""")
main_layout.addWidget(self.log_title)
# 日志文本框
self.log_text = QTextEdit()
self.log_text.setFixedHeight(380) # 设置固定高度以显示更多日志行
self.log_text.setStyleSheet("""
QTextEdit {
background-color: #f8f9fa;
color: #333333;
border: 1px solid #dadce0;
border-radius: 5px;
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-size: 11px;
padding: 10px;
}
""")
self.log_text.setReadOnly(True)
main_layout.addWidget(self.log_text)
# 清空日志按钮 (右下角)
clear_layout = QHBoxLayout()
clear_layout.addStretch()
self.clear_log_btn = QPushButton(self.tr('clear_log'))
self.clear_log_btn.setFixedSize(100, 30)
self.clear_log_btn.setStyleSheet("""
QPushButton {
background-color: #9aa0a6;
color: white;
font-size: 11px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #80868b;
}
QPushButton:pressed {
background-color: #5f6368;
}
""")
self.clear_log_btn.clicked.connect(self.clear_log)
clear_layout.addWidget(self.clear_log_btn)
main_layout.addLayout(clear_layout)
# 7. 底部GitHub链接
self.github_btn = QPushButton(self.tr('github'))
self.github_btn.setFixedSize(120, 40)
self.github_btn.setStyleSheet("""
QPushButton {
background-color: #333333;
color: white;
font-size: 11px;
font-weight: bold;
border: none;
border-radius: 5px;
}
QPushButton:hover {
background-color: #555555;
}
QPushButton:pressed {
background-color: #222222;
}
""")
self.github_btn.clicked.connect(self.open_github)
github_layout = QHBoxLayout()
github_layout.addStretch()
github_layout.addWidget(self.github_btn)
github_layout.addStretch()
main_layout.addLayout(github_layout)
# 添加初始日志
self.log(self.tr('tool_started'))
self.log("=" * 50)
self.initialize_status_check()
def change_language(self, language_text):
"""切换语言"""
language_map = {
'中文': 'zh',
'English': 'en',
'Русский': 'ru',
'Português (BR)': 'pt-br'
}
new_language = language_map.get(language_text, 'zh')
if new_language != self.current_language:
self.current_language = new_language
self.update_ui_text()
def update_ui_text(self):
"""更新界面文本"""
# 更新窗口标题
self.setWindowTitle(self.tr('window_title'))
# 更新标签文本
self.title_label.setText(self.tr('window_title'))
self.intro_label.setText(self.tr('intro_text'))
self.operation_title.setText(self.tr('operation_area'))
self.log_title.setText(self.tr('operation_log'))
# 更新按钮文本
self.one_click_btn.setText(self.tr('one_click_config'))
self.close_qoder_btn.setText(self.tr('close_qoder'))
self.reset_machine_id_btn.setText(self.tr('reset_machine_id'))
self.reset_telemetry_btn.setText(self.tr('reset_telemetry'))
self.deep_clean_btn.setText(self.tr('deep_identity_clean'))
self.login_clean_btn.setText(self.tr('login_identity_clean'))
self.hardware_reset_btn.setText(self.tr('hardware_fingerprint_reset'))
self.clear_log_btn.setText(self.tr('clear_log'))
self.github_btn.setText(self.tr('github'))
# 更新复选框文本
self.preserve_chat_checkbox.setText(self.tr('preserve_chat'))
# 清空日志并重新初始化
self.log_text.clear()
self.log(self.tr('tool_started'))
self.log("=" * 50)
def log(self, message):
"""添加日志消息"""
timestamp = datetime.now().strftime("%H:%M:%S")
log_message = f"[{timestamp}] {message}"
self.log_text.append(log_message)
# 自动滚动到最新日志
scrollbar = self.log_text.verticalScrollBar()
scrollbar.setValue(scrollbar.maximum())
def clear_log(self):
"""清空日志"""
self.log_text.clear()
self.log(self.tr('log_cleared'))
def get_qoder_data_dir(self):
"""获取Qoder数据目录路径(跨平台支持)"""
home_dir = Path.home()
system = platform.system()
if system == "Windows":
# Windows: %APPDATA%\Qoder
return home_dir / "AppData" / "Roaming" / "Qoder"
else:
# 默认使用macOS路径作为fallback
return home_dir / "Library" / "Application Support" / "Qoder"
def initialize_status_check(self):
"""初始化时检查各项状态"""
try:
# 1. 检查Qoder进程状态
self.log("1. 检查Qoder进程状态...")
is_running, pids = self.check_qoder_running()
if is_running:
self.log(f" ✅ Qoder正在运行 (PID: {', '.join(pids)})")
else:
self.log(" ✅ Qoder未运行")
# 2. 检查Qoder目录
self.log("2. 检查Qoder目录...")
qoder_support_dir = self.get_qoder_data_dir()
if qoder_support_dir.exists():
self.log(f" ✅ Qoder目录存在")
# 3. 检查机器ID文件
self.log("3. 检查机器ID文件...")
machine_id_file = qoder_support_dir / "machineid"
if machine_id_file.exists():
try:
with open(machine_id_file, 'r') as f:
current_id = f.read().strip()
self.log(f" ✅ 机器ID: {current_id}")
except Exception as e:
self.log(f" ❌ 读取机器ID失败: {e}")
else:
self.log(" ❌ 机器ID文件不存在")
# 4. 检查遥测数据文件
self.log("4. 检查遥测数据文件...")
storage_json_file = qoder_support_dir / "User/globalStorage/storage.json"
if storage_json_file.exists():
try:
with open(storage_json_file, 'r', encoding='utf-8') as f:
data = json.load(f)
if 'telemetry.machineId' in data:
machine_id = data['telemetry.machineId']
self.log(f" ✅ 遥测机器ID: {machine_id[:16]}...")
else:
self.log(" ⚠️ 未找到遥测机器ID")
if 'telemetry.devDeviceId' in data:
device_id = data['telemetry.devDeviceId']
self.log(f" ✅ 设备ID: {device_id}")
else:
self.log(" ⚠️ 未找到设备ID")
except Exception as e:
self.log(f" ❌ 读取遥测数据失败: {e}")
else:
self.log(" ❌ 遥测数据文件不存在")
# 5. 检查缓存目录
self.log("5. 检查缓存目录...")
cache_dirs = [
"Cache", "blob_storage", "Code Cache", "SharedClientCache",
"GPUCache", "DawnGraphiteCache", "DawnWebGPUCache"
]
cache_count = 0
for cache_dir in cache_dirs:
cache_path = qoder_support_dir / cache_dir
if cache_path.exists():
cache_count += 1
self.log(f" ✅ 发现 {cache_count}/{len(cache_dirs)} 个缓存目录")
# 6. 检查对话记录相关目录
self.log("6. 检查对话记录...")
chat_dirs = [
"User/workspaceStorage", "User/History", "logs", "CachedData"
]
chat_count = 0
for chat_dir in chat_dirs:
chat_path = qoder_support_dir / chat_dir
if chat_path.exists():
chat_count += 1
self.log(f" ✅ 发现 {chat_count}/{len(chat_dirs)} 个对话相关目录")
# 7. 检查身份识别文件(新增)
self.log("7. 检查身份识别文件...")
identity_files = [
"Network Persistent State", "Cookies", "SharedStorage",
"Trust Tokens", "TransportSecurity", "Preferences"
]
identity_count = 0
for identity_file in identity_files:
file_path = qoder_support_dir / identity_file
if file_path.exists():
identity_count += 1
self.log(f" ✅ 发现 {identity_count}/{len(identity_files)} 个身份识别文件")
# 8. 检查 SharedClientCache 内部文件
self.log("8. 检查 SharedClientCache 内部文件...")
shared_cache = qoder_support_dir / "SharedClientCache"
if shared_cache.exists():
critical_files = [".info", ".lock", "mcp.json"]
shared_count = 0
for file_name in critical_files:
if (shared_cache / file_name).exists():
shared_count += 1
# 检查 index 目录
if (shared_cache / "index").exists():
shared_count += 1
self.log(f" ✅ SharedClientCache 内部文件: {shared_count}/4 个")
else:
self.log(" ⚠️ SharedClientCache 目录不存在")
# 9. 检查 Keychain 和证书存储(新增)
self.log("9. 检查 Keychain 和证书存储...")
keychain_files = [
"cert_transparency_reporter_state.json",
"Certificate Revocation Lists",
"SSLCertificates"
]
keychain_count = 0
for keychain_file in keychain_files:
file_path = qoder_support_dir / keychain_file
if file_path.exists():
keychain_count += 1
self.log(f" ✅ 发现 {keychain_count}/{len(keychain_files)} 个证书/安全文件")
# 10. 检查用户活动记录(新增)
self.log("10. 检查用户活动记录...")
activity_files = [
"ActivityLog", "EventLog", "UserActivityLog",
"Login Credentials", "Web Data", "Web Data-journal"
]
activity_count = 0
for activity_file in activity_files:
file_path = qoder_support_dir / activity_file
if file_path.exists():
activity_count += 1
self.log(f" ✅ 发现 {activity_count}/{len(activity_files)} 个活动记录文件")
# 11. 检查设备指纹相关文件(新增)
self.log("11. 检查设备指纹相关文件...")
fingerprint_files = [
"DeviceMetadata", "HardwareInfo", "SystemInfo",
"QuotaManager", "QuotaManager-journal",
"databases/Databases.db", "databases/Databases.db-journal"
]
fingerprint_count = 0
for fingerprint_file in fingerprint_files:
file_path = qoder_support_dir / fingerprint_file
if file_path.exists():
fingerprint_count += 1
self.log(f" ✅ 发现 {fingerprint_count}/{len(fingerprint_files)} 个设备指纹文件")
else:
self.log(" ❌ Qoder目录不存在")
self.log(" 请确保已安装Qoder应用程序")
self.log("=" * 50)
self.log("状态检查完成,可以开始操作")
except Exception as e:
self.log(f"❌ 状态检查失败: {e}")
self.log("=" * 50)
def check_qoder_running(self):
"""检查Qoder是否正在运行"""
try:
result = subprocess.run(['pgrep', '-f', 'Qoder'],
capture_output=True, text=True)
if result.returncode == 0:
pids = result.stdout.strip().split('\n')
return True, pids
except:
pass
return False, []
def generate_system_version(self, system_type):
"""根据系统类型生成合适的系统版本号"""
if system_type == "Darwin": # macOS
# macOS 版本号格式: 14.x.x (Sonoma), 13.x.x (Ventura), 12.x.x (Monterey)
major_versions = [12, 13, 14, 15] # 支持新版本
major = random.choice(major_versions)
minor = random.randint(0, 6)
patch = random.randint(0, 9)
return f"{major}.{minor}.{patch}"
elif system_type == "Windows":
# Windows 10/11 版本号
versions = [
"10.0.19045", # Windows 10 22H2
"10.0.22621", # Windows 11 22H2
"10.0.22631", # Windows 11 23H2
"10.0.26100" # Windows 11 24H2
]
base_version = random.choice(versions)
# 添加随机的小版本号
build_suffix = random.randint(1, 999)
return f"{base_version}.{build_suffix}"
else: # Linux 或其他系统
# Linux 内核版本号格式: 5.x.x, 6.x.x
major_versions = [5, 6]
major = random.choice(major_versions)
if major == 5:
minor = random.randint(10, 19) # 5.10-5.19
else: # major == 6
minor = random.randint(0, 8) # 6.0-6.8
patch = random.randint(0, 50)
return f"{major}.{minor}.{patch}"
def close_qoder(self):
"""关闭Qoder"""
self.log("正在检查 Qoder 运行状态...")
is_running, pids = self.check_qoder_running()
if is_running:
self.log(f"检测到 Qoder 正在运行 (PID: {', '.join(pids)})")
self.log("请手动关闭 Qoder 应用程序")
QMessageBox.information(self, "检测到 Qoder 正在运行",
f"检测到 Qoder 正在运行 (PID: {', '.join(pids)})\n\n"
"请手动关闭 Qoder 应用程序:\n"
"1. 使用 Cmd+Q 快捷键\n"
"2. 或从菜单选择 Qoder → 退出 Qoder")
else:
self.log("Qoder 未运行")
QMessageBox.information(self, "状态检查", "Qoder 当前未运行")
def login_identity_cleanup(self):
"""专门清理登录相关身份信息"""
self.log("开始清理登录相关身份信息...")
# 检查Qoder是否在运行
is_running, pids = self.check_qoder_running()
if is_running:
reply = QMessageBox.question(self, "检测到 Qoder 正在运行",
f"检测到 Qoder 正在运行 (PID: {', '.join(pids)})\n\n"
"登录身份清理需要先关闭 Qoder。\n"
"请手动关闭后点击'Yes'继续。",
QMessageBox.Yes | QMessageBox.No)
if reply != QMessageBox.Yes:
self.log("用户取消操作")
return
# 再次检查
is_running, _ = self.check_qoder_running()
if is_running:
self.log("Qoder 仍在运行,操作取消")
QMessageBox.critical(self, "错误", "请先完全关闭 Qoder 应用程序")
return
# 确认操作
reply = QMessageBox.question(self, "确认清理登录身份",
f"登录身份清理将:\n\n"
f"• 清除所有登录证书和 Cookies\n"
f"• 清除 SharedClientCache 登录状态\n"
f"• 清除网络状态和会话存储\n"
f"• 清除设备认证信息\n"
f"• 清除 nonce 和 challenge 相关数据\n\n"
f"这将使 Qoder 无法识别之前的登录状态,确定继续吗?",
QMessageBox.Yes | QMessageBox.No)
if reply != QMessageBox.Yes:
self.log("用户取消登录身份清理")
return
try:
qoder_support_dir = self.get_qoder_data_dir()
if not qoder_support_dir.exists():
raise Exception("未找到 Qoder 应用数据目录")
self.log("=" * 40)
self.log("开始登录身份清理")
self.log("=" * 40)
# 执行登录身份清理
self.perform_login_identity_cleanup(qoder_support_dir)
self.log("=" * 40)
self.log("登录身份清理完成!")
self.log("=" * 40)
QMessageBox.information(self, "完成", "登录身份清理完成!\n现在可以重新启动 Qoder。")
except Exception as e:
self.log(f"登录身份清理失败: {e}")
QMessageBox.critical(self, "错误", f"登录身份清理失败: {e}")
def perform_login_identity_cleanup(self, qoder_support_dir):
"""执行登录相关身份清理"""
try: