mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 13:06:30 +02:00
Revert "Fix time, it actually uses the RFC now"
This reverts commit d0e4ccb681555c79bf1d3ddea8c0fab760bf661f.
This commit is contained in:
parent
d0e4ccb681
commit
fa2f7e499e
@ -1,4 +1,5 @@
|
|||||||
package curseforge
|
package curseforge
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -7,6 +8,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -145,14 +147,31 @@ func getModInfo(modID int) (modInfo, error) {
|
|||||||
return infoRes, nil
|
return infoRes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cfDateFormatString = "2006-01-02T15:04:05.999"
|
||||||
|
|
||||||
|
type cfDateFormat struct {
|
||||||
|
time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *cfDateFormat) UnmarshalJSON(input []byte) error {
|
||||||
|
trimmed := strings.Trim(string(input), `"`)
|
||||||
|
time, err := time.Parse(cfDateFormatString, trimmed)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Time = time
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// modFileInfo is a subset of the deserialised JSON response from the Curse API for mod files
|
// modFileInfo is a subset of the deserialised JSON response from the Curse API for mod files
|
||||||
type modFileInfo struct {
|
type modFileInfo struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
FileName string `json:"fileNameOnDisk"`
|
FileName string `json:"fileNameOnDisk"`
|
||||||
FriendlyName string `json:"fileName"`
|
FriendlyName string `json:"fileName"`
|
||||||
Date time.Time `json:"fileDate"`
|
Date cfDateFormat `json:"fileDate"`
|
||||||
Length int `json:"fileLength"`
|
Length int `json:"fileLength"`
|
||||||
FileType int `json:"releaseType"`
|
FileType int `json:"releaseType"`
|
||||||
// fileStatus? means latest/preferred?
|
// fileStatus? means latest/preferred?
|
||||||
DownloadURL string `json:"downloadUrl"`
|
DownloadURL string `json:"downloadUrl"`
|
||||||
GameVersions []string `json:"gameVersion"`
|
GameVersions []string `json:"gameVersion"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user