Improved installation process

This commit is contained in:
Eduard Urbach 2018-04-07 14:17:33 +02:00
parent 27264d691a
commit c5c05aea04
6 changed files with 44 additions and 71 deletions

View File

@ -13,12 +13,11 @@
## Download the repository
* `go get github.com/animenotifier/notify.moe`
* `go get github.com/animenotifier/notify.moe/...`
## Build all
* `cd $GOPATH/src/github.com/animenotifier/notify.moe`
* `make tools` to install [pack](https://github.com/aerogo/pack) & [run](https://github.com/aerogo/run)
* `make all`
## Browser

View File

@ -9,6 +9,9 @@ BUILDPATCHES=@./patches/build.sh
BUILDBOTS=@./bots/build.sh
TSCMD=@tsc
IPTABLES=@sudo iptables
PACK:=$(shell command -v pack 2> /dev/null)
RUN:=$(shell command -v run 2> /dev/null)
GOIMPORTS:=$(shell command -v goimports 2> /dev/null)
# Determine the name of the platform
OSNAME=
@ -42,20 +45,36 @@ test:
$(GOTEST) github.com/animenotifier/notify.moe -v -cover
bench:
$(GOTEST) -bench .
pack:
go get -u github.com/aerogo/pack
go install github.com/aerogo/pack
run:
go get -u github.com/aerogo/run
go install github.com/aerogo/run
goimports:
go get -u golang.org/x/tools/cmd/goimports
go install golang.org/x/tools/cmd/goimports
tools:
ifeq ($(OSNAME),OSX)
brew install coreutils
endif
go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/aerogo/pack
go get -u github.com/aerogo/run
go install github.com/aerogo/pack
go install github.com/aerogo/run
ifndef GOIMPORTS
@make goimports
endif
ifndef PACK
@make pack
endif
ifndef RUN
@make run
endif
versions:
@go version
$(TSCMD) --version
assets:
$(TSCMD)
@pack
deps:
@go get -v ./...
depslist:
$(GOCMD) list -f {{.Deps}} | sed -e 's/\[//g' -e 's/\]//g' | tr " " "\n"
clean:
@ -75,6 +94,6 @@ endif
ifeq ($(OSNAME),OSX)
@/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors
endif
all: assets server bots jobs patches
all: tools assets server bots jobs patches
.PHONY: bots jobs patches ports
.PHONY: tools assets server bots jobs patches ports clean versions

View File

@ -68,6 +68,15 @@ func updateUserInfo(ctx *aero.Context, user *arn.User) {
// Updates the location of the user.
func updateUserLocation(user *arn.User, newIP string) {
user.IP = newIP
if arn.APIKeys.IPInfoDB.ID == "" {
if arn.IsProduction() {
color.Red("IPInfoDB key not defined")
}
return
}
locationAPI := "https://api.ipinfodb.com/v3/ip-city/?key=" + arn.APIKeys.IPInfoDB.ID + "&ip=" + user.IP + "&format=json"
response, err := client.Get(locationAPI).End()

View File

@ -1,9 +1,11 @@
component Login(target string)
.login-buttons.mountable
a.login-button.login-button-google(href="/auth/google", target=target, data-ajax="false")
Icon("google")
span Sign in via Google
if arn.APIKeys.Google.Secret != ""
a.login-button.login-button-google(href="/auth/google", target=target, data-ajax="false")
Icon("google")
span Sign in via Google
a.login-button.login-button-facebook(href="/auth/facebook", target=target, data-ajax="false")
Icon("facebook")
span Sign in via Facebook
if arn.APIKeys.Facebook.Secret != ""
a.login-button.login-button-facebook(href="/auth/facebook", target=target, data-ajax="false")
Icon("facebook")
span Sign in via Facebook

View File

@ -1,16 +0,0 @@
package main
import (
"github.com/animenotifier/arn"
)
func main() {
defer arn.Node.Close()
for anime := range arn.StreamAnime() {
providerID := anime.GetMapping("anilist/anime")
arn.DB.Delete("AniListToAnime", providerID)
anime.RemoveMapping("anilist/anime", providerID)
anime.Save()
}
}

View File

@ -1,40 +0,0 @@
package main
import (
"fmt"
"github.com/animenotifier/anilist"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
var userName = "Akyoto"
var allAnime []*arn.Anime
func init() {
allAnime = arn.AllAnime()
}
func main() {
user, _ := arn.GetUserByNick(userName)
animeList, err := anilist.GetAnimeList(user.Accounts.AniList.Nick)
arn.PanicOnError(err)
importList(animeList.Lists.Watching)
importList(animeList.Lists.Completed)
}
func importList(animeListItems []*anilist.AnimeListItem) {
imported := []*arn.Anime{}
for _, item := range animeListItems {
anime := arn.FindAniListAnime(item.Anime, allAnime)
if anime != nil {
fmt.Println(item.Anime.TitleRomaji, "=>", anime.Title.Romaji)
imported = append(imported, anime)
}
}
color.Green("%d / %d", len(imported), len(animeListItems))
}