Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0

finish repo transfer

Cette révision appartient à :
PantsuDev 2017-05-17 15:58:40 +10:00
Parent 0807ca5d5d
révision 70f87e7aac
67 fichiers modifiés avec 280 ajouts et 285 suppressions

Voir le fichier

@ -6,7 +6,7 @@ before_install:
script:
# Downloads deps automatically. No need to add manually.
- go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -e -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | grep -v 'github.com/ewhal/nyaa' | xargs go get -v
- go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -e -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | grep -v 'github.com/NyaaPantsu/nyaa' | xargs go get -v
- go get
- go build
- go vet

Voir le fichier

@ -1,4 +1,4 @@
Copyright (c) 2016 Eliot Whalan <ewhal@pantsu.cat>
Copyright (c) 2016 PantsuDev <pantsudev@local>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

Voir le fichier

@ -1,6 +1,6 @@
![nyanpasu~](https://my.mixtape.moe/aglaxe.png)
# Nyaa replacement [![Build Status](https://travis-ci.org/ewhal/nyaa.svg?branch=master)](https://travis-ci.org/ewhal/nyaa)
# Nyaa replacement [![Build Status](https://travis-ci.org/NyaaPantsu/nyaa.svg?branch=master)](https://travis-ci.org/NyaaPantsu/nyaa)
## Motivation
The aim of this project is to write a fully featured nyaa replacement in golang
@ -18,7 +18,7 @@ You can view the public trello board [here](https://trello.com/b/gMJBwoRq/nyaa-p
# Installation
Ubuntu 17.04 fails to build, use a different OS or docker
* Install [Golang](https://golang.org/doc/install) (version >=1.8)
* `go get github.com/ewhal/nyaa`
* `go get github.com/NyaaPantsu/nyaa`
* `go build`
* Download DB and place it in your root folder named as "nyaa.db"
* `./nyaa`
@ -57,7 +57,7 @@ download [dos2unix](https://sourceforge.net/projects/dos2unix/files/latest/downl
on the /deploy/init.sh to convert CR+LF to LF.
```sh
# Make sure the project is in here $GOPATH/src/github.com/ewhal/nyaa
# Make sure the project is in here $GOPATH/src/github.com/NyaaPantsu/nyaa
$ cd deploy/
# You may choose another backend by pointing to the
# appropriate docker-compose file.

12
cache/cache.go externe
Voir le fichier

@ -1,12 +1,12 @@
package cache
import (
"github.com/ewhal/nyaa/cache/memcache"
"github.com/ewhal/nyaa/cache/native"
"github.com/ewhal/nyaa/cache/nop"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/cache/memcache"
"github.com/NyaaPantsu/nyaa/cache/native"
"github.com/NyaaPantsu/nyaa/cache/nop"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/model"
)
// Cache defines interface for caching search results

Voir le fichier

@ -1,8 +1,8 @@
package memcache
import (
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
type Memcache struct {

Voir le fichier

@ -5,8 +5,8 @@ import (
"sync"
"time"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
const expiryTime = time.Minute

Voir le fichier

@ -4,8 +4,8 @@ import (
"sync"
"testing"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
// Basic test for deadlocks and race conditions

4
cache/nop/nop.go externe
Voir le fichier

@ -1,8 +1,8 @@
package nop
import (
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
type NopCache struct {

Voir le fichier

@ -1,12 +1,12 @@
package database
import (
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/database/postgres"
//"github.com/ewhal/nyaa/db/sqlite"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/database/postgres"
//"github.com/NyaaPantsu/nyaa/db/sqlite"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util/log"
"errors"
)

Voir le fichier

@ -1,8 +1,8 @@
package postgres
import (
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
func (db *Database) InsertComment(comment *model.Comment) (err error) {

Voir le fichier

@ -3,7 +3,7 @@ package postgres
import (
"database/sql"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/log"
_ "github.com/lib/pq"
)

Voir le fichier

@ -4,8 +4,8 @@ import (
"database/sql"
"fmt"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
func (db *Database) InsertTorrentReport(report *model.TorrentReport) (err error) {

Voir le fichier

@ -2,7 +2,7 @@ package postgres
import (
"database/sql"
"github.com/ewhal/nyaa/common"
"github.com/NyaaPantsu/nyaa/common"
)
func (db *Database) RecordScrapes(scrape []common.ScrapeResult) (err error) {

Voir le fichier

@ -4,7 +4,7 @@ import (
"database/sql"
"fmt"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/model"
)
const queryGetAllTorrents = "GetAllTorrents"

Voir le fichier

@ -1,7 +1,7 @@
package postgres
import (
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/model"
"database/sql"
)

Voir le fichier

@ -4,8 +4,8 @@ import (
"database/sql"
"fmt"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
func userParamToSelectQuery(p *common.UserParam) (q sqlQuery) {

Voir le fichier

@ -5,8 +5,8 @@ import (
"fmt"
"strings"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
)
// build sql query from SearchParam for torrent search

Voir le fichier

@ -1,10 +1,10 @@
package db
import (
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/azhao12345/gorm"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util/log"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)

Voir le fichier

@ -4,8 +4,8 @@ import (
"fmt"
"testing"
"github.com/NyaaPantsu/nyaa/config"
"github.com/azhao12345/gorm"
"github.com/ewhal/nyaa/config"
)
type errorLogger struct {
@ -54,7 +54,7 @@ func TestGormInitSqlite(t *testing.T) {
// - psql -c "CREATE USER nyaapantsu WITH PASSWORD 'nyaapantsu';" -U postgres
//
// Then enable the test by setting this variable to "true" via ldflags:
// go test ./... -v -ldflags="-X github.com/ewhal/nyaa/db.testPostgres=true"
// go test ./... -v -ldflags="-X github.com/NyaaPantsu/nyaa/db.testPostgres=true"
var testPostgres = "false"
func TestGormInitPostgres(t *testing.T) {

Voir le fichier

@ -8,7 +8,7 @@ if [[ "${PANTSU_DBTYPE}" = "postgres" ]]; then
sleep 40
fi
go get github.com/ewhal/nyaa
go get github.com/NyaaPantsu/nyaa
go build
./nyaa -host 0.0.0.0 \
-port "${PANTSU_INTERNAL_PORT}" \

24
main.go
Voir le fichier

@ -8,18 +8,18 @@ import (
"os"
"time"
"github.com/ewhal/nyaa/cache"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/network"
"github.com/ewhal/nyaa/router"
"github.com/ewhal/nyaa/service/scraper"
"github.com/ewhal/nyaa/service/torrent/metainfoFetcher"
"github.com/ewhal/nyaa/service/user"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/util/log"
"github.com/ewhal/nyaa/util/search"
"github.com/ewhal/nyaa/util/signals"
"github.com/NyaaPantsu/nyaa/cache"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/network"
"github.com/NyaaPantsu/nyaa/router"
"github.com/NyaaPantsu/nyaa/service/scraper"
"github.com/NyaaPantsu/nyaa/service/torrent/metainfoFetcher"
"github.com/NyaaPantsu/nyaa/service/user"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/search"
"github.com/NyaaPantsu/nyaa/util/signals"
)
// RunServer runs webapp mainloop

Voir le fichier

@ -1,7 +1,7 @@
package model
import (
"github.com/ewhal/nyaa/config"
"github.com/NyaaPantsu/nyaa/config"
"time"
)

Voir le fichier

@ -1,8 +1,8 @@
package model
import (
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/util"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/util"
"fmt"
"html/template"
@ -132,10 +132,10 @@ func (t *Torrent) ToJSON() TorrentJSON {
commentsJSON = append(commentsJSON, CommentJSON{Username: c.Username, UserID: -1, Content: template.HTML(c.Content), Date: c.Date.UTC()})
}
for _, c := range t.Comments {
if (c.User != nil) {
commentsJSON = append(commentsJSON, CommentJSON{Username: c.User.Username, UserID: int(c.User.ID), Content: util.MarkdownToHTML(c.Content), Date: c.CreatedAt.UTC()})
if c.User != nil {
commentsJSON = append(commentsJSON, CommentJSON{Username: c.User.Username, UserID: int(c.User.ID), Content: util.MarkdownToHTML(c.Content), Date: c.CreatedAt.UTC()})
} else {
commentsJSON = append(commentsJSON, CommentJSON{})
commentsJSON = append(commentsJSON, CommentJSON{})
}
}
fileListJSON := make([]FileJSON, 0, len(t.FileList))

Voir le fichier

@ -2,8 +2,8 @@ package network
import (
"fmt"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/majestrate/i2p-tools/lib/i2p"
"net"
)

Voir le fichier

@ -9,14 +9,14 @@ import (
"strings"
"time"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service"
"github.com/ewhal/nyaa/service/api"
"github.com/ewhal/nyaa/service/torrent"
"github.com/ewhal/nyaa/util"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service"
"github.com/NyaaPantsu/nyaa/service/api"
"github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/gorilla/mux"
)

Voir le fichier

@ -1,16 +1,16 @@
package router;
package router
import (
"encoding/json"
"net/http"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/service/user"
"github.com/NyaaPantsu/nyaa/service/user"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/gorilla/mux"
)
type LanguagesJSONResponse struct {
Current string `json:"current"`
Current string `json:"current"`
Languages map[string]string `json:"languages"`
}
@ -59,4 +59,3 @@ func ChangeLanguageHandler(w http.ResponseWriter, r *http.Request) {
url, _ := Router.Get("home").URL()
http.Redirect(w, r, url.String(), http.StatusSeeOther)
}

Voir le fichier

@ -3,7 +3,7 @@ package router
import (
"net/http"
"github.com/ewhal/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/gorilla/mux"
)

Voir le fichier

@ -5,13 +5,13 @@ import (
"net/http"
"strconv"
"github.com/ewhal/nyaa/cache"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service/torrent"
"github.com/ewhal/nyaa/util"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/cache"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/gorilla/mux"
)

Voir le fichier

@ -7,18 +7,18 @@ import (
"strconv"
"strings"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service"
"github.com/ewhal/nyaa/service/comment"
"github.com/ewhal/nyaa/service/report"
"github.com/ewhal/nyaa/service/torrent"
"github.com/ewhal/nyaa/service/user"
form "github.com/ewhal/nyaa/service/user/form"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/util/log"
"github.com/ewhal/nyaa/util/search"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service"
"github.com/NyaaPantsu/nyaa/service/comment"
"github.com/NyaaPantsu/nyaa/service/report"
"github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/service/user"
form "github.com/NyaaPantsu/nyaa/service/user/form"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/search"
"github.com/gorilla/mux"
)

Voir le fichier

@ -3,7 +3,7 @@ package router
import (
"net/http"
"github.com/ewhal/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/gorilla/mux"
)

Voir le fichier

@ -3,7 +3,7 @@ package router
import (
"net/http"
"github.com/ewhal/nyaa/service/captcha"
"github.com/NyaaPantsu/nyaa/service/captcha"
// "github.com/gorilla/handlers"
"github.com/gorilla/mux"
)
@ -22,34 +22,34 @@ func init() {
gzipUserProfileHandler := http.HandlerFunc(UserProfileHandler)
gzipUserDetailsHandler := http.HandlerFunc(UserDetailsHandler)
gzipUserProfileFormHandler := http.HandlerFunc(UserProfileFormHandler)
/*
// Enable GZIP compression for all handlers except imgHandler and captcha
gzipCSSHandler := cssHandler)
gzipJSHandler:= jsHandler)
gzipSearchHandler:= http.HandlerFunc(SearchHandler)
gzipAPIUploadHandler := http.HandlerFunc(ApiUploadHandler)
gzipAPIUpdateHandler := http.HandlerFunc(ApiUpdateHandler)
gzipFaqHandler := http.HandlerFunc(FaqHandler)
gzipRSSHandler := http.HandlerFunc(RSSHandler)
gzipUploadHandler := http.HandlerFunc(UploadHandler)
gzipUserRegisterFormHandler := http.HandlerFunc(UserRegisterFormHandler)
gzipUserLoginFormHandler := http.HandlerFunc(UserLoginFormHandler)
gzipUserVerifyEmailHandler := http.HandlerFunc(UserVerifyEmailHandler)
gzipUserRegisterPostHandler := http.HandlerFunc(UserRegisterPostHandler)
gzipUserLoginPostHandler := http.HandlerFunc(UserLoginPostHandler)
gzipUserLogoutHandler := http.HandlerFunc(UserLogoutHandler)
gzipUserFollowHandler := http.HandlerFunc(UserFollowHandler)
/*
// Enable GZIP compression for all handlers except imgHandler and captcha
gzipCSSHandler := cssHandler)
gzipJSHandler:= jsHandler)
gzipSearchHandler:= http.HandlerFunc(SearchHandler)
gzipAPIUploadHandler := http.HandlerFunc(ApiUploadHandler)
gzipAPIUpdateHandler := http.HandlerFunc(ApiUpdateHandler)
gzipFaqHandler := http.HandlerFunc(FaqHandler)
gzipRSSHandler := http.HandlerFunc(RSSHandler)
gzipUploadHandler := http.HandlerFunc(UploadHandler)
gzipUserRegisterFormHandler := http.HandlerFunc(UserRegisterFormHandler)
gzipUserLoginFormHandler := http.HandlerFunc(UserLoginFormHandler)
gzipUserVerifyEmailHandler := http.HandlerFunc(UserVerifyEmailHandler)
gzipUserRegisterPostHandler := http.HandlerFunc(UserRegisterPostHandler)
gzipUserLoginPostHandler := http.HandlerFunc(UserLoginPostHandler)
gzipUserLogoutHandler := http.HandlerFunc(UserLogoutHandler)
gzipUserFollowHandler := http.HandlerFunc(UserFollowHandler)
gzipIndexModPanel := http.HandlerFunc(IndexModPanel)
gzipTorrentsListPanel := http.HandlerFunc(TorrentsListPanel)
gzipTorrentReportListPanel := http.HandlerFunc(TorrentReportListPanel)
gzipUsersListPanel := http.HandlerFunc(UsersListPanel)
gzipCommentsListPanel := http.HandlerFunc(CommentsListPanel)
gzipTorrentEditModPanel := http.HandlerFunc(TorrentEditModPanel)
gzipTorrentPostEditModPanel := http.HandlerFunc(TorrentPostEditModPanel)
gzipCommentDeleteModPanel := http.HandlerFunc(CommentDeleteModPanel)
gzipTorrentDeleteModPanel := http.HandlerFunc(TorrentDeleteModPanel)
gzipTorrentReportDeleteModPanel := http.HandlerFunc(TorrentReportDeleteModPanel)*/
gzipIndexModPanel := http.HandlerFunc(IndexModPanel)
gzipTorrentsListPanel := http.HandlerFunc(TorrentsListPanel)
gzipTorrentReportListPanel := http.HandlerFunc(TorrentReportListPanel)
gzipUsersListPanel := http.HandlerFunc(UsersListPanel)
gzipCommentsListPanel := http.HandlerFunc(CommentsListPanel)
gzipTorrentEditModPanel := http.HandlerFunc(TorrentEditModPanel)
gzipTorrentPostEditModPanel := http.HandlerFunc(TorrentPostEditModPanel)
gzipCommentDeleteModPanel := http.HandlerFunc(CommentDeleteModPanel)
gzipTorrentDeleteModPanel := http.HandlerFunc(TorrentDeleteModPanel)
gzipTorrentReportDeleteModPanel := http.HandlerFunc(TorrentReportDeleteModPanel)*/
//gzipTorrentReportCreateHandler := http.HandlerFunc(CreateTorrentReportHandler)
//gzipTorrentReportDeleteHandler := http.HandlerFunc(DeleteTorrentReportHandler)

Voir le fichier

@ -1,11 +1,11 @@
package router
import (
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/util"
"github.com/ewhal/nyaa/util/search"
"github.com/gorilla/mux"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/search"
"github.com/gorilla/feeds"
"github.com/gorilla/mux"
"html"
"net/http"
"strconv"
@ -15,7 +15,7 @@ import (
func RSSHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
page := vars["page"]
var err error
pagenum := 1
if page != "" {

Voir le fichier

@ -1,11 +1,11 @@
package router
import (
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/util/log"
"github.com/ewhal/nyaa/util/search"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/search"
"github.com/gorilla/mux"
"html"
"net/http"

Voir le fichier

@ -7,9 +7,9 @@ import (
"net/url"
"strconv"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/ewhal/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/nicksnyder/go-i18n/i18n"
)

Voir le fichier

@ -4,10 +4,10 @@ import (
"net/http"
"net/url"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service/user"
userForms "github.com/ewhal/nyaa/service/user/form"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service/user"
userForms "github.com/NyaaPantsu/nyaa/service/user/form"
"github.com/gorilla/mux"
)
@ -188,7 +188,7 @@ type PanelTorrentReassignVbs struct {
*/
type Navigation struct {
TotalItem int
MaxItemPerPage int // FIXME: shouldn't this be in SearchForm?
MaxItemPerPage int // FIXME: shouldn't this be in SearchForm?
CurrentPage int
Route string
}

Voir le fichier

@ -4,9 +4,9 @@ package router
"net/http"
"strconv"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service/moderation"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service/moderation"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/gorilla/mux"
)*/

Voir le fichier

@ -15,11 +15,11 @@ import (
"strconv"
"strings"
"github.com/ewhal/nyaa/cache"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/service/upload"
"github.com/ewhal/nyaa/util"
"github.com/ewhal/nyaa/util/metainfo"
"github.com/NyaaPantsu/nyaa/cache"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/service/upload"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/metainfo"
"github.com/microcosm-cc/bluemonday"
"github.com/zeebo/bencode"
)
@ -158,12 +158,12 @@ func (f *UploadForm) ExtractInfo(r *http.Request) error {
// extract filesize
f.Filesize = int64(torrent.TotalSize())
// extract filelist
fileInfos := torrent.Info.GetFiles()
for _, fileInfo := range fileInfos {
f.FileList = append(f.FileList, UploadedFile{
Path: fileInfo.Path,
Path: fileInfo.Path,
Filesize: int64(fileInfo.Length),
})
}

Voir le fichier

@ -6,12 +6,12 @@ import (
"strconv"
"time"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service/captcha"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/ewhal/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service/captcha"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/gorilla/mux"
)

Voir le fichier

@ -5,13 +5,13 @@ import (
"net/http"
"strconv"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service/captcha"
"github.com/ewhal/nyaa/service/user"
"github.com/ewhal/nyaa/service/user/form"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/util/modelHelper"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service/captcha"
"github.com/NyaaPantsu/nyaa/service/user"
"github.com/NyaaPantsu/nyaa/service/user/form"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/modelHelper"
"github.com/gorilla/mux"
)

Voir le fichier

@ -6,14 +6,14 @@ import (
"strings"
"time"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service/captcha"
"github.com/ewhal/nyaa/service/torrent"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/ewhal/nyaa/util"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service/captcha"
"github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/gorilla/mux"
)

Voir le fichier

@ -12,10 +12,10 @@ import (
"regexp"
"strings"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service"
"github.com/ewhal/nyaa/service/upload"
"github.com/ewhal/nyaa/util/metainfo"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service"
"github.com/NyaaPantsu/nyaa/service/upload"
"github.com/NyaaPantsu/nyaa/util/metainfo"
"github.com/zeebo/bencode"
)

Voir le fichier

@ -1,9 +1,9 @@
package commentService
import (
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
)
func GetAllComments(limit int, offset int, conditions string, values ...interface{}) ([]model.Comment, int) {

Voir le fichier

@ -6,9 +6,9 @@ import (
"strconv"
"strings"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service"
)
// Return torrentReport in case we did modified it (ie: CreatedAt field)

Voir le fichier

@ -5,7 +5,7 @@ import (
"net"
"sync"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/model"
)
const InitialConnectionID = 0x41727101980

Voir le fichier

@ -1,10 +1,10 @@
package scraperService
import (
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util/log"
"net"
"net/url"
"time"

Voir le fichier

@ -6,10 +6,10 @@ import (
"net"
"time"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util/log"
)
// TransactionTimeout 30 second timeout for transactions

Voir le fichier

@ -1,14 +1,14 @@
package metainfoFetcher
import (
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
serviceBase "github.com/NyaaPantsu/nyaa/service"
torrentService "github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/anacrolix/torrent"
"github.com/anacrolix/torrent/metainfo"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
serviceBase "github.com/ewhal/nyaa/service"
torrentService "github.com/ewhal/nyaa/service/torrent"
"github.com/ewhal/nyaa/util/log"
"golang.org/x/time/rate"
"math"
"sync"

Voir le fichier

@ -1,19 +1,19 @@
package metainfoFetcher;
package metainfoFetcher
import (
"github.com/anacrolix/torrent/metainfo"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util"
"errors"
"time"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util"
"github.com/anacrolix/torrent/metainfo"
"strings"
"time"
)
type FetchOperation struct {
fetcher *MetainfoFetcher
torrent model.Torrent
done chan int
fetcher *MetainfoFetcher
torrent model.Torrent
done chan int
}
type Result struct {
@ -24,9 +24,9 @@ type Result struct {
func NewFetchOperation(fetcher *MetainfoFetcher, dbEntry model.Torrent) (op *FetchOperation) {
op = &FetchOperation{
fetcher: fetcher,
torrent: dbEntry,
done: make(chan int, 1),
fetcher: fetcher,
torrent: dbEntry,
done: make(chan int, 1),
}
return
}
@ -56,5 +56,3 @@ func (op *FetchOperation) Start(out chan Result) {
break
}
}

Voir le fichier

@ -1,10 +1,10 @@
package metainfoFetcher;
package metainfoFetcher
import (
"testing"
"github.com/NyaaPantsu/nyaa/model"
"github.com/anacrolix/torrent"
"github.com/ewhal/nyaa/model"
)
func TestInvalidHash(t *testing.T) {
@ -14,9 +14,9 @@ func TestInvalidHash(t *testing.T) {
}
fetcher := &MetainfoFetcher{
timeout: 5,
timeout: 5,
torrentClient: client,
results: make(chan Result, 1),
results: make(chan Result, 1),
}
dbEntry := model.Torrent{
@ -42,4 +42,3 @@ func TestInvalidHash(t *testing.T) {
t.Logf("Got error %s, shouldn't be timeout", res.err)
}

Voir le fichier

@ -6,11 +6,11 @@ import (
"strconv"
"strings"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service"
"github.com/ewhal/nyaa/util"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service"
"github.com/NyaaPantsu/nyaa/util"
)
/* Function to interact with Models

Voir le fichier

@ -2,11 +2,11 @@ package userService
import (
"errors"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
formStruct "github.com/ewhal/nyaa/service/user/form"
"github.com/ewhal/nyaa/util/modelHelper"
"github.com/ewhal/nyaa/util/timeHelper"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
formStruct "github.com/NyaaPantsu/nyaa/service/user/form"
"github.com/NyaaPantsu/nyaa/util/modelHelper"
"github.com/NyaaPantsu/nyaa/util/timeHelper"
"github.com/gorilla/securecookie"
"golang.org/x/crypto/bcrypt"
"net/http"
@ -47,11 +47,11 @@ func EncodeCookie(user_id uint) (string, error) {
func ClearCookie(w http.ResponseWriter) (int, error) {
cookie := &http.Cookie{
Name: CookieName,
Value: "",
Path: "/",
Name: CookieName,
Value: "",
Path: "/",
HttpOnly: true,
MaxAge: -1,
MaxAge: -1,
}
http.SetCookie(w, cookie)
return http.StatusOK, nil
@ -88,9 +88,9 @@ func SetCookieHandler(w http.ResponseWriter, email string, pass string) (int, er
return http.StatusInternalServerError, err
}
cookie := &http.Cookie{
Name: CookieName,
Value: encoded,
Path: "/",
Name: CookieName,
Value: encoded,
Path: "/",
HttpOnly: true,
}
http.SetCookie(w, cookie)

Voir le fichier

@ -3,7 +3,7 @@ package form
import (
"regexp"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/log"
)
const EMAIL_REGEX = `(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})`
@ -64,13 +64,13 @@ type LoginForm struct {
// UserForm is used when updating a user.
type UserForm struct {
Username string `form:"username" needed:"true" len_min:"3" len_max:"20"`
Email string `form:"email"`
Language string `form:"language" default:"en-us"`
CurrentPassword string `form:"current_password" len_min:"6" len_max:"72" omit:"true"`
Password string `form:"password" len_min:"6" len_max:"72" equalInput:"Confirm_Password"`
Confirm_Password string `form:"password_confirmation" omit:"true"`
Status int `form:"status" default:"0"`
Username string `form:"username" needed:"true" len_min:"3" len_max:"20"`
Email string `form:"email"`
Language string `form:"language" default:"en-us"`
CurrentPassword string `form:"current_password" len_min:"6" len_max:"72" omit:"true"`
Password string `form:"password" len_min:"6" len_max:"72" equalInput:"Confirm_Password"`
Confirm_Password string `form:"password_confirmation" omit:"true"`
Status int `form:"status" default:"0"`
}
// PasswordForm is used when updating a user password.

Voir le fichier

@ -1,12 +1,11 @@
package userPermission
import (
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util/log"
)
// HasAdmin checks that user has an admin permission.
func HasAdmin(user *model.User) bool {
return user.Status == 2

Voir le fichier

@ -7,14 +7,14 @@ import (
"strconv"
"time"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
formStruct "github.com/ewhal/nyaa/service/user/form"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/ewhal/nyaa/util/crypto"
"github.com/ewhal/nyaa/util/log"
"github.com/ewhal/nyaa/util/modelHelper"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
formStruct "github.com/NyaaPantsu/nyaa/service/user/form"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util/crypto"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/modelHelper"
"golang.org/x/crypto/bcrypt"
)

Voir le fichier

@ -2,11 +2,11 @@ package userService
import (
"errors"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"net/http"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/log"
)
// FindUserByUserName creates a user.

Voir le fichier

@ -7,12 +7,12 @@ import (
"strconv"
"time"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/util/email"
"github.com/ewhal/nyaa/util/languages"
"github.com/ewhal/nyaa/util/timeHelper"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util/email"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/timeHelper"
"github.com/gorilla/securecookie"
)

Voir le fichier

@ -57,7 +57,7 @@ http://tracker.baka-sub.cf/announce</pre>
<p>{{T "answer_how_can_i_help"}}</p>
<h2>{{T "your_design_sucks_found_a_bug"}}</h2>
<p><a href="https://github.com/ewhal/nyaa/issues">https://github.com/ewhal/nyaa/issues</a>.</p>
<p><a href="https://github.com/NyaaPantsu/nyaa/issues">https://github.com/NyaaPantsu/nyaa/issues</a>.</p>
<h2>{{T "why_written_in_go"}}</h2>
<p>{{T "authors_favorite_language"}}</p>

Voir le fichier

@ -3,8 +3,8 @@ package email
import (
"path/filepath"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/util/log"
gomail "gopkg.in/gomail.v2"
)

Voir le fichier

@ -8,8 +8,8 @@ import (
"path"
"path/filepath"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/model"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/model"
"github.com/nicksnyder/go-i18n/i18n"
"github.com/nicksnyder/go-i18n/i18n/language"
)

Voir le fichier

@ -4,7 +4,7 @@ import (
"path"
"testing"
"github.com/ewhal/nyaa/config"
"github.com/NyaaPantsu/nyaa/config"
)
func TestInitI18n(t *testing.T) {

Voir le fichier

@ -4,8 +4,8 @@ import (
"net/http"
"os"
"github.com/NyaaPantsu/nyaa/config"
"github.com/Sirupsen/logrus"
"github.com/ewhal/nyaa/config"
lumberjack "gopkg.in/natefinch/lumberjack.v2"
)

Voir le fichier

@ -2,7 +2,7 @@ package modelHelper
import (
"fmt"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/log"
"net/http"
"reflect"
"strconv"

Voir le fichier

@ -7,14 +7,14 @@ import (
"unicode"
"unicode/utf8"
"github.com/ewhal/nyaa/cache"
"github.com/ewhal/nyaa/common"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/db"
"github.com/ewhal/nyaa/model"
"github.com/ewhal/nyaa/service"
"github.com/ewhal/nyaa/service/torrent"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/cache"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/db"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service"
"github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/util/log"
)
var searchOperator string

Voir le fichier

@ -4,7 +4,7 @@ import (
"net/http"
"runtime/debug"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/log"
)
func SendError(w http.ResponseWriter, err error, code int) {

Voir le fichier

@ -3,8 +3,8 @@
package signals
import (
"github.com/ewhal/nyaa/router"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/router"
"github.com/NyaaPantsu/nyaa/util/log"
"os"
"os/signal"
"syscall"

Voir le fichier

@ -3,7 +3,7 @@ package timeHelper
import (
"time"
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/log"
)
func FewDaysLater(day int) time.Time {

Voir le fichier

@ -1,7 +1,7 @@
package util
import (
"github.com/ewhal/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/log"
"bytes"
"compress/zlib"