update comments
This commit is contained in:
parent
120d61d1b6
commit
f308e4351a
14
main.go
14
main.go
@ -34,9 +34,9 @@ type ROMCache struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
romDirectory = "public" // directory where ROMs are available for download
|
romDirectory = "public" // directory where ROMs are available for download
|
||||||
buildOutDirectory = "out" // directory from build system containing artifacts which we can move to romDirectory
|
buildOutDirectory = "out" // directory from build system containing artifacts which we can move to romDirectory
|
||||||
cacheFile = "public/romcache.json"
|
cacheFile = "public/romcache.json" // persistence between server restarts so we don't have to rehash all the ROM files each time the program starts
|
||||||
)
|
)
|
||||||
|
|
||||||
var ( // evil global variable
|
var ( // evil global variable
|
||||||
@ -67,7 +67,7 @@ func init() {
|
|||||||
log.Printf("loaded cached file: %s", rom.Filename)
|
log.Printf("loaded cached file: %s", rom.Filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if any new build artifacts and preload the romCache
|
// Check if any new build artifacts and load any new files into the romCache
|
||||||
moveBuildArtifacts()
|
moveBuildArtifacts()
|
||||||
go updateROMCache()
|
go updateROMCache()
|
||||||
}
|
}
|
||||||
@ -179,9 +179,11 @@ func updateROMCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// http - GET /
|
// http - GET /
|
||||||
// Writes JSON response for the updater app to know what versions are available to download
|
// The LineageOS updater app needs a JSON array of type LineageOSROM
|
||||||
|
// Marshal's romCache.ROMs to JSON to serve as the response body
|
||||||
|
|
||||||
func lineageOSROMListHandler(w http.ResponseWriter, r *http.Request) {
|
func lineageOSROMListHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
go func() {
|
go func() { // Also checks for new builds - TBD need a better method as the first request will return no new updates. inotify?
|
||||||
newBuilds := moveBuildArtifacts()
|
newBuilds := moveBuildArtifacts()
|
||||||
if newBuilds {
|
if newBuilds {
|
||||||
updateROMCache()
|
updateROMCache()
|
||||||
|
Loading…
Reference in New Issue
Block a user