2018-04-25 14:51:24 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2019-04-23 05:52:55 +00:00
|
|
|
"github.com/akyoto/color"
|
2018-04-25 14:51:24 +00:00
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/arn/autocorrect"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
color.Yellow("Updating user references")
|
|
|
|
defer arn.Node.Close()
|
|
|
|
|
|
|
|
count := 0
|
|
|
|
|
|
|
|
for user := range arn.StreamUsers() {
|
|
|
|
old := user.Website
|
|
|
|
user.Website = autocorrect.Website(user.Website)
|
|
|
|
|
|
|
|
if user.Website != old {
|
|
|
|
fmt.Println(color.YellowString(old), "->", color.YellowString(user.Website))
|
|
|
|
count++
|
|
|
|
user.Save()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
color.Green("%d links have been corrected.", count)
|
|
|
|
}
|