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 ## Download the repository
* `go get github.com/animenotifier/notify.moe` * `go get github.com/animenotifier/notify.moe/...`
## Build all ## Build all
* `cd $GOPATH/src/github.com/animenotifier/notify.moe` * `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` * `make all`
## Browser ## Browser

View File

@ -9,6 +9,9 @@ BUILDPATCHES=@./patches/build.sh
BUILDBOTS=@./bots/build.sh BUILDBOTS=@./bots/build.sh
TSCMD=@tsc TSCMD=@tsc
IPTABLES=@sudo iptables 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 # Determine the name of the platform
OSNAME= OSNAME=
@ -42,20 +45,36 @@ test:
$(GOTEST) github.com/animenotifier/notify.moe -v -cover $(GOTEST) github.com/animenotifier/notify.moe -v -cover
bench: bench:
$(GOTEST) -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: tools:
ifeq ($(OSNAME),OSX) ifeq ($(OSNAME),OSX)
brew install coreutils brew install coreutils
endif endif
go get -u golang.org/x/tools/cmd/goimports ifndef GOIMPORTS
go get -u github.com/aerogo/pack @make goimports
go get -u github.com/aerogo/run endif
go install github.com/aerogo/pack ifndef PACK
go install github.com/aerogo/run @make pack
endif
ifndef RUN
@make run
endif
versions: versions:
@go version @go version
$(TSCMD) --version
assets: assets:
$(TSCMD) $(TSCMD)
@pack @pack
deps:
@go get -v ./...
depslist: depslist:
$(GOCMD) list -f {{.Deps}} | sed -e 's/\[//g' -e 's/\]//g' | tr " " "\n" $(GOCMD) list -f {{.Deps}} | sed -e 's/\[//g' -e 's/\]//g' | tr " " "\n"
clean: clean:
@ -75,6 +94,6 @@ endif
ifeq ($(OSNAME),OSX) ifeq ($(OSNAME),OSX)
@/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors @/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors
endif 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. // Updates the location of the user.
func updateUserLocation(user *arn.User, newIP string) { func updateUserLocation(user *arn.User, newIP string) {
user.IP = newIP 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" locationAPI := "https://api.ipinfodb.com/v3/ip-city/?key=" + arn.APIKeys.IPInfoDB.ID + "&ip=" + user.IP + "&format=json"
response, err := client.Get(locationAPI).End() response, err := client.Get(locationAPI).End()

View File

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