Skip to content

Commit

Permalink
feat: advanced import
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodCoder666 committed May 27, 2023
1 parent 389e4b1 commit 1798663
Show file tree
Hide file tree
Showing 9 changed files with 576 additions and 64 deletions.
14 changes: 2 additions & 12 deletions MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,15 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="btnWait_Load">
<widget class="QPushButton" name="btnWait_Import">
<property name="toolTip">
<string>从文件导入IP列表。</string>
<string>从指定来源导入IP列表。</string>
</property>
<property name="text">
<string>导入</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnWait_Sync">
<property name="toolTip">
<string>从远程服务器上获取IP列表。</string>
</property>
<property name="text">
<string>同步</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnWait_Test">
<property name="toolTip">
Expand Down
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,29 @@ python main.py

...(若有其他需求欢迎在[issues](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues)中提出)

## 关于在线同步功能

本项目作者提供的 IP 库在打开软件时会自动导入。程序还提供了在线导入其他 IP 库的功能,地址如下:

- 精简 IPv4:
- 官方:https://unpkg.com/@hcfy/google-translate-ip/ips.txt
- 备用1(ghproxy 镜像):https://ghproxy.com/https://raw.githubusercontent.com/hcfyapp/google-translate-cn-ip/master/packages/google-translate-ip/ips.txt
- 备用2(jsDelivr CDN):https://cdn.jsdelivr.net/npm/@hcfy/google-translate-ip/ips.txt
- 扩展 IPv4:
- 官方1:https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/ip.txt
- 官方2:https://ghproxy.com/https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/ip.txt
- 备用(GitCode 镜像):https://gitcode.net/mirrors/Ponderfly/GoogleTranslateIpCheck/-/raw/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/ip.txt
- 标准 IPv6:
- 官方1:https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/IPv6.txt
- 官方2:https://ghproxy.com/https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/IPv6.txt
- 备用(GitCode 镜像):https://gitcode.net/mirrors/Ponderfly/GoogleTranslateIpCheck/-/raw/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/IPv6.txt

程序会自动找到可用的网址并导入 IP 库(设置备用网址是因为 raw.githubusercontent.com 访问不稳定)。导入一般需要 5-10 秒,请耐心等待。

感谢 @hcfyapp@Ponderfly 提供的 IP 库。

## 版权说明

本项目使用[GPLv3](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/blob/main/LICENSE)版权许可。IP 扫描逻辑参考 [https://repo.or.cz/gscan_quic](https://repo.or.cz/gscan_quic)

类似的项目:[hcfyapp/google-translate-cn-ip](https://github.com/hcfyapp/google-translate-cn-ip) [Ponderfly/GoogleTranslateIpCheck](https://github.com/Ponderfly/GoogleTranslateIpCheck)

特别感谢 [hcfyapp/google-translate-cn-ip](https://github.com/hcfyapp/google-translate-cn-ip) 中提供的 IP 地址列表。自动同步功能的 IP 列表地址:[https://unpkg.com/@hcfy/google-translate-ip/ips.txt](https://unpkg.com/@hcfy/google-translate-ip/ips.txt)
类似的项目:[hcfyapp/google-translate-cn-ip](https://github.com/hcfyapp/google-translate-cn-ip) [Ponderfly/GoogleTranslateIpCheck](https://github.com/Ponderfly/GoogleTranslateIpCheck)
16 changes: 16 additions & 0 deletions dlgImport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from PySide6.QtWidgets import QDialog, QDialogButtonBox
from PySide6.QtCore import Slot
from ui_dlgImport import Ui_Dialog

__all__ = ['dlgImport']

class dlgImport(QDialog):
def __init__(self, parent=None):
super().__init__(parent)

self.ui = Ui_Dialog()
self.ui.setupUi(self)

self.ui.buttonBox.button(QDialogButtonBox.Ok).setText('导入')
self.ui.buttonBox.button(QDialogButtonBox.Cancel).setText('取消')
269 changes: 269 additions & 0 deletions dlgImport.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>266</width>
<height>326</height>
</rect>
</property>
<property name="windowTitle">
<string>导入选项</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_Mode">
<property name="title">
<string>导入模式</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioAppend">
<property name="text">
<string>添加并去重</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioReplace">
<property name="text">
<string>替换全部</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_Source">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>导入来源</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="radioLocalFile">
<property name="text">
<string>本地文件</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="radioSingleIP">
<property name="text">
<string>单个 IP:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="singleIPEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="radioOnline">
<property name="text">
<string>在线服务:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>30</number>
</property>
<item>
<widget class="QCheckBox" name="chkBox_std4">
<property name="text">
<string>精简 IPv4</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkBox_ext4">
<property name="text">
<string>扩展 IPv4</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkBox_std6">
<property name="text">
<string>标准 IPv6</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QRadioButton" name="radioCustomURL">
<property name="text">
<string>自定义 URL:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="customURLEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioOnline</sender>
<signal>toggled(bool)</signal>
<receiver>chkBox_std4</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>126</x>
<y>158</y>
</hint>
<hint type="destinationlabel">
<x>141</x>
<y>185</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioOnline</sender>
<signal>toggled(bool)</signal>
<receiver>chkBox_ext4</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>126</x>
<y>158</y>
</hint>
<hint type="destinationlabel">
<x>141</x>
<y>211</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioOnline</sender>
<signal>toggled(bool)</signal>
<receiver>chkBox_std6</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>126</x>
<y>158</y>
</hint>
<hint type="destinationlabel">
<x>141</x>
<y>237</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioSingleIP</sender>
<signal>toggled(bool)</signal>
<receiver>singleIPEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>56</x>
<y>131</y>
</hint>
<hint type="destinationlabel">
<x>172</x>
<y>131</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioCustomURL</sender>
<signal>toggled(bool)</signal>
<receiver>customURLEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>68</x>
<y>265</y>
</hint>
<hint type="destinationlabel">
<x>184</x>
<y>265</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit 1798663

Please sign in to comment.