Skip to content

Commit

Permalink
refactor(all): 项目大重构,优化大量内容。
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmJos committed Sep 16, 2022
1 parent 697fba4 commit 320603f
Show file tree
Hide file tree
Showing 19 changed files with 540 additions and 409 deletions.
18 changes: 18 additions & 0 deletions .doc/REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 配置文件参数

### `主域名` domain

`www.baidu.com` 中的 _baidu.com_ 就是主域名。

### 主机记录 `record`

`www.baidu.com` 中的 _www_ 就是主机记录;
`@` 符号代表通过直接通过主域名直通访问。

### ipv6 (IPv6记录)

该记录是否为IPv6 *(AAAA)* 记录,默认为 `false`

### access-key (访问密键) & access-secret (访问密钥)

用于验证更改域名内容,在阿里云的个人控制台中获取。
18 changes: 16 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,22 @@ jobs:
server-id: github
server-username: MAVEN_USERNAME
server-password: MAVEN_TOKEN

- name: "Deploy"
run: mvn -B deploy -DskipTests --file pom.xml
run: mvn -B deploy --file pom.xml
env:
MAVEN_USERNAME: ${{ github.repository_owner }}
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: "Copy example configuration"
run: cp target/example.yml .asset/

- name: "Release Asset Upload"
id: upload-release-asset
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .asset/*.jar
asset_content_type: application/java-archive
40 changes: 36 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
/.idea/
/target/
./*.iml
*.iml
.asset/
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/
**.iws
**.iml
**.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
60 changes: 36 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,40 @@ java -jar aliddns-updater-<version>.jar

## 配置文件示例

关于请求的具体配置内容请参考 [请求配置](.doc/REQUEST.md)

```yaml
version: 1.7
# 配置文件版本,请不要修改。
version: 2.0

#输出域名记录查询返回信息
# 是否输出域名记录查询返回信息。(用于调试)
debug: false

Service:
#更新间隔(毫秒)
period: 900000
# 阿里云地域ID,可以不改动
service:
# 更新间隔,单位为秒。
period: 900
# 阿里云接口地域ID,可以不改动
# 请参考 https://help.aliyun.com/knowledge_detail/40654.html
region-id: "cn-hangzhou"
# IP地址查询相关设定
# 用于获取对应的IP地址,以更新到域名
region-id: cn-hangzhou

# 本机IP查询接口配置。
# 用于获取对应的IP地址,以更新到域名记录。
query:
# IPv4地址获取链接
v4: http://ifconfig.me/ip
# IPv6地址获取链接 (可选)
# 如不需要IPV6,则可以直接将地址留空。
ipQuery:
IPv4: "http://ifconfig.me/ip"
IPv6: "https://v6.ip.zxinc.org/getip"


#更新任务列表
UpdateRequests:
test:
domain: "test.cn" # 域名,如 www.baidu.com 中的 baidu.com
AccessKey: "xx" # 访问密钥 (在个人控制台中获取)
AccessSecret: "xx" # 访问密码 (在个人控制台中获取)
record: "www" #主机记录
ipv6: false # 该记录是否为IPv6[AAAA]记录 (默认为false)
v6: https://v6.ip.zxinc.org/getip

# 更新任务配置。
# 具体配置请参考 https://github.com/CarmJos/AliDDNS-Updater/blob/master/.doc/REQUEST.md
requests:
demo:
domain: example.com
record: '@'
ipv6: false
access-key: YOUR-ACCESS-KEY
access-secret: YOUR-ACCESS-SECRET
```
## 守护进程示例
Expand All @@ -56,6 +62,10 @@ UpdateRequests:
请参考 [windows环境下批处理实现守护进程](https://blog.csdn.net/qin9r3y/article/details/22805095)
## 视频教程
您可以 [点击这里](https://www.bilibili.com/video/BV1t54y147aQ) 查看由开发者本人制作的简易视频讲解。
## 支持与捐赠
若您觉得本软件做的不错,您可以捐赠支持我!
Expand All @@ -77,8 +87,10 @@ UpdateRequests:
> #### 可以用来盈利
> 你可以在分发软件的时候收费,但你必须在收费前向你的客户提供该软件的 GNU GPL 许可协议,以便让他们知道,他们可以从别的渠道免费得到这份软件,以及你收费的理由。
> #### 可自由修改
> 如果你想添加或删除某个功能,没问题,如果你想在别的项目中使用部分代码,也没问题,唯一的要求是,使用了这段代码的项目也必须使用 GPL 协议。
> 如果你想添加或删除某个功能,没问题,如果你想在别的项目中使用部分代码,也没问题,唯一的要求是,使用了这段代码的项目也必须使用
> GPL 协议。
>
> 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。
> 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下
> @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。
>
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
119 changes: 67 additions & 52 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

<groupId>cc.carm.app</groupId>
<artifactId>aliddns-updater</artifactId>
<version>2.0.3</version>
<version>3.0.0</version>
<packaging>jar</packaging>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.jdk.version>8</project.jdk.version>
<maven.compiler.source>${project.jdk.version}</maven.compiler.source>
<maven.compiler.target>${project.jdk.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>

<mainClass>cc.carm.app.aliddns.Main</mainClass>
</properties>

Expand All @@ -24,12 +26,12 @@

<issueManagement>
<system>GitHub Issues</system>
<url>${project.url}/issues</url>
<url>https://github.com/CarmJos/AliDDNS-Updater/issues</url>
</issueManagement>

<ciManagement>
<system>GitHub Actions</system>
<url>${project.url}/actions/workflows/maven.yml</url>
<url>https://github.com/CarmJos/AliDDNS-Updater/actions/workflows/maven.yml</url>
</ciManagement>

<developers>
Expand Down Expand Up @@ -57,7 +59,7 @@
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/CarmJos/${project.name}</url>
</repository>
<downloadUrl>${project.url}/releases</downloadUrl>
<downloadUrl>https://github.com/CarmJos/AliDDNS-Updater/releases</downloadUrl>
</distributionManagement>

<repositories>
Expand Down Expand Up @@ -94,44 +96,52 @@
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-alidns</artifactId>
<version>2.6.19</version>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core -->
<!--suppress VulnerableLibrariesLocal -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.17</version>
<version>4.6.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<!-- https://github.com/alibaba/fastjson -->
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.73</version>
<version>1.2.83</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>cc.bukkit</groupId>
<artifactId>BukkitConfiguration</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<groupId>cc.carm.lib</groupId>
<artifactId>easyconfiguration-yaml</artifactId>
<version>3.2.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>githubreleases4j</artifactId>
<version>1.3.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
<version>23.0.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>

Expand All @@ -142,19 +152,43 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArgument>-parameters</compilerArgument>
<filesets>
<fileset>
<directory>${project.basedir}/.asset/</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${project.jdk.version}</source>
<target>${project.jdk.version}</target>
<encoding>UTF-8</encoding>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -182,46 +216,27 @@
</execution>
</executions>
<configuration>
<finalName>${project.name}-${project.version}</finalName>
<outputDirectory>${project.basedir}/.asset</outputDirectory>

<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<!-- when downloading via Maven we can pull depends individually -->
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptRef>jar-with-dependencies</descriptRef>
</descriptorRefs>
<archive>
<manifest>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</plugin>
</plugins>
Expand Down
Loading

0 comments on commit 320603f

Please sign in to comment.