-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ddnupdater new version notification
- Loading branch information
Showing
4 changed files
with
40 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
package server | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
"encoding/json" | ||
"net/http" | ||
) | ||
|
||
type GitHubRelease struct { | ||
TagName string `json:"tag_name"` | ||
TagName string `json:"tag_name"` | ||
} | ||
|
||
func getLatestRelease() (string, error) { | ||
resp, err := http.Get("https://api.github.com/repos/qdm12/ddns-updater/releases/latest") | ||
if err != nil { | ||
return "", err | ||
} | ||
defer resp.Body.Close() | ||
resp, err := http.Get("https://api.github.com/repos/qdm12/ddns-updater/releases/latest") | ||
if err != nil { | ||
return "", err | ||
} | ||
defer resp.Body.Close() | ||
|
||
var release GitHubRelease | ||
if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { | ||
return "", err | ||
} | ||
var release GitHubRelease | ||
if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { | ||
return "", err | ||
} | ||
|
||
return release.TagName, nil | ||
} | ||
return release.TagName, nil | ||
} | ||
|
||
// Add a function to get the current version | ||
func getCurrentVersion() string { | ||
// Replace with actual logic to get the current version | ||
return "v1.0.0" | ||
} |