diff --git a/jobs/user-references/user-references.go b/jobs/user-references/user-references.go new file mode 100644 index 00000000..662f13b2 --- /dev/null +++ b/jobs/user-references/user-references.go @@ -0,0 +1,31 @@ +package main + +import ( + "github.com/animenotifier/arn" + "github.com/fatih/color" +) + +func main() { + color.Yellow("Updating user references") + + // Delete Nick:User records + arn.Truncate("NickToUser") + + // Get a stream of all anime + allUsers, err := arn.AllUsers() + + if err != nil { + panic(err) + } + + // Iterate over the stream + count := 0 + for user := range allUsers { + count++ + println(count, user.Nick) + + user.ChangeNick(user.Nick) + } + + color.Green("Finished.") +} diff --git a/main.go b/main.go index 862407b7..119107bd 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,6 @@ package main import ( - "io/ioutil" - "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/pages/airing" @@ -57,20 +55,16 @@ func main() { return ctx.JSON(app.Config.Manifest) }) + // Scripts + app.Get("/scripts.js", func(ctx *aero.Context) string { + return ctx.File("temp/scripts.js") + }) + // For benchmarks app.Get("/hello", func(ctx *aero.Context) string { return ctx.Text("Hello World") }) - // Scripts - scripts, _ := ioutil.ReadFile("temp/scripts.js") - js := string(scripts) - - app.Get("/scripts.js", func(ctx *aero.Context) string { - ctx.SetHeader("Content-Type", "application/javascript") - return js - }) - // Let's go app.Run() }