Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0
Nyaa.se replacement written in golang
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
Aller au fichier
kilo d5c2c6b676 Upload to nyaa.si, anidex & TokyoTosho [done] (#1633)
* Update upload.go

* Update helpers.go

* Update template_test.go

* Update upload_multiple.jet.html

* change variable names

* wrong copypaste

* change variable name

* ditto

* Fix travis

* Update main.css

* Update upload.go

* Update upload.jet.html

* Update main.css

* Update upload.go

* More compact form

* CSS changes to go along

* Update main.css

* Update upload.jet.html

* Slightly lower bottom margin

* Update upload_multiple.jet.html

* tomorrow color adjustements

* small css adjustements

* Update upload.go

* Update default_config.yml

* Update default_config.yml

* Update structs.go

* Update user.go

* Update structs.go

* Update upload.go

* Update default_config.yml

* Update upload_multiple.jet.html

* Update upload.go

* Update upload.jet.html

* Update template_test.go

* this one is optional for anidex

* Update default_config.yml

* Possible improvement
As mentionned in my comment, it seems that having a checkbox already checked and disabled for logged in user + having the input text for apikey is a bit tedious.
Moreover, asking to check and fill the input text to upload in anidex when you are not logged is doing things twice. If you don't want to upload to anidex, don't fill the input.

So this commit push a new behaviour:
* If you are logged in and you have filled your anidex/nyaasi api key : the form should only show the checkbox asking if you want to upload to nyaasi.
* If you're not logged in or you don't have filled your api key in your profile settings: you only show the input text for the api key and not the checkbox. If someone wants to upload to nyaasi/anidex, he will just need to fill the input.

* This adds back the support of anonymous upload when logged in or not.
This works simply by checking if the user wants to upload as anon (when he checks the checkbox "upload as anonymous") or by checking the emptyness of apikey.
+ reverts the condition statements since it was needed to have apikey empty

* Forgot to save this file

* This commit adds the go routines for each upload service (anidex, nyaasi, tosho).
New controller and url to check the upload status (/upload/status/:id).
If you add ?json at the end, it outputs a json format of the multi upload status.
To prevent memory overload, we only keep in memory the multiupload status for 5 minutes.
Moved multipleform struct from templates to upload utils.

* fix form display on classic theme

* This commit adds:
* Javascript refreshing of the upload status
* Localization of the pages
* Fixed some bugs

This works, only need to get torrent file now.

* Added a new function to get the Path to the torrent file.

* Added a function to check that a torrent file exists and if not generate it on multiupload

* Enabled file upload through http post request to anidex

* Fixed bugs

* Modified the behaviour to generate torrent preivously. It is a synchrone function now. So we need to make it asynchronous in download.go

Now torrents file are always generated at upload time in a background processus with the correct trackers (needed ones + the ones provided by the user).
I made the anidex tracker as a needed one to allow multiupload even if the user hasn't included in his torrent file/magnet url.

* Moving deadtrackers list to default config
Support torrent file creation when upload without scraping
* Fix possible bug where no one is seeding a torrent yet (first time upload)
Add primary tracker in torrent file

* Fixing issue with boolean pointer for private torrent

* fixing index out of range for announcelist filtering
Fixing anidex tracker not found

* Fixing lang id error

* Anidex upload works

* Fix for multiupload with magnet

* This adds TokyoTosho support. Since TokyoTosho API only support upload by URL (and not torrent file upload). We need to make the download url available without ddos protection.

Also TokyoTosho doesn't need a category select. Since it does have limited option, we can automatically convert our categories to the tokyotosho one.

* Removing the folder tosho and put categories.go directly in upload package.
Added category conversion for nyaasi too.
Added tests on category conversion.

* This should add nyaasi support.
Is not tested though.

* Updated defaut config with new nyaa.si behaviour?

* Forgot to commit this file
2018-01-03 18:21:07 +10:00
Godeps Torrent Generation on not found error (#1600) 2017-10-21 09:40:43 +02:00
apidoc Fix Api documetation (#1685) 2017-10-18 22:27:55 +02:00
config Upload to nyaa.si, anidex & TokyoTosho [done] (#1633) 2018-01-03 18:21:07 +10:00
controllers Upload to nyaa.si, anidex & TokyoTosho [done] (#1633) 2018-01-03 18:21:07 +10:00
models Upload to nyaa.si, anidex & TokyoTosho [done] (#1633) 2018-01-03 18:21:07 +10:00
public Upload to nyaa.si, anidex & TokyoTosho [done] (#1633) 2018-01-03 18:21:07 +10:00
templates Upload to nyaa.si, anidex & TokyoTosho [done] (#1633) 2018-01-03 18:21:07 +10:00
translations Upload to nyaa.si, anidex & TokyoTosho [done] (#1633) 2018-01-03 18:21:07 +10:00
utils Upload to nyaa.si, anidex & TokyoTosho [done] (#1633) 2018-01-03 18:21:07 +10:00
vendor Torrent Generation on not found error (#1600) 2017-10-21 09:40:43 +02:00
.eslintrc.json Fix most go lint warnings 2017-07-23 15:50:18 +10:00
.gitattributes Update .gitattibutes (#956) 2017-06-07 08:41:16 +10:00
.gitignore Torrent Generation on not found error (#1600) 2017-10-21 09:40:43 +02:00
.htmlhintrc Fix more style issues 2017-07-24 15:03:43 +10:00
.travis.yml On-demand stats fetching (#1621) 2017-10-06 17:06:14 +02:00
CODE_OF_CONDUCT.md makefile and CoC (#1741) 2017-11-17 00:56:36 +01:00
LICENSE.md Fix most go lint warnings 2017-07-23 15:50:18 +10:00
Makefile * add makefile for build (#1594) 2017-09-18 17:21:48 +02:00
README.md Torrent Generation on not found error (#1600) 2017-10-21 09:40:43 +02:00
apidoc.json Fix most go lint warnings 2017-07-23 15:50:18 +10:00
header_api.md Fix most go lint warnings 2017-07-23 15:50:18 +10:00
main.go Cacheforpg (#1415) 2017-08-28 09:15:57 +10:00
network.go Remove common package 2017-07-02 16:54:55 +02:00
network_test.go New network test + fix import 2017-07-30 02:16:14 +02:00
package.sh Refine form linked up & edited buildversion to commit hash (#1025) 2017-06-20 10:06:01 +10:00

README.md

nyanpasu~

Nyaa replacement Build Status Go Report Card GoDocCoverage Status

Motivation

The aim of this project is to write a fully featured nyaa replacement in golang that anyone will be able to deploy locally or remotely.

Roadmap

As of August 17th the trello board has been moved to GitHub Projects

The Roadmap will give you an overview of the features and tasks that the project are currently discussing, working on and have completed. If you are looking for a feature that is not listed just make a GitHub Issue and it will get added to the trello board.

You can view the public GitHub Projects board here or click on the "Roadmap".

Requirements

  • Golang golang

Installation

All tested versions of Ubuntu fail to build, use a different OS or docker

  • Install Golang (version >=1.8)
  • go get -u github.com/tools/godep
  • go get github.com/NyaaPantsu/nyaa On Windows, a specific version of GCC is used to build a specific depedency we use The GCC version packaged with msys2 should work

Now proceed to build godep Either use:

  • godep go build Or use this to have the build version in index.html:

  • godep go build -ldflags "-X main.buildversion=$(git rev-parse HEAD)" Or you can build using package.sh (Windows & Linux):

  • ./package.sh

  • Download the DB and place it in your root folder named as "nyaa.db" (You want the merged.sqlite3 database, see the dev IRC for more info)

  • ./nyaa

  • You can now access your local site over on localhost:9999

Usage

Type ./nyaa -h for the list of options.

Systemd

  • Edit the unit file os/nyaa.service to your liking
  • Copy the package's content so that your unit file can find them.
  • Copy the unit file in /usr/lib/systemd/system
  • systemctl daemon-reload
  • systemctl start nyaa

The provided unit file uses options directly; if you prefer a config file, do the following:

  • ./nyaa -print-defaults > /etc/nyaa.conf
  • Edit nyaa.conf to your liking
  • Replace in the unit file the options by -conf /etc/nyaa.conf

Docker

We support docker for easy development and deployment. Simply install docker and docker-compose by following the instructions here.

Once you've successfully installed docker, make sure you have the database file in the project's directory as nyaa.db. Then, follow these steps to build and run the application.

Windows Users If you get "standard_init_linux.go:178: exec user process caused "no such file or directory" download dos2unix and run "dos2unix.exe" on the /deploy/init.sh to convert CR+LF to LF.

# 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.
$ docker-compose -f docker-compose.sqlite.yml build
$ docker-compose -f docker-compose.sqlite.yml up

Access the website by going to localhost:9999.

For postgres, place the dump in the toplevel directory and name it to nyaa_psql.backup.

LICENSE

This project is licensed under the MIT License - see the LICENSE.md file for details

Contributing

Use tabs for css and js files.

Contributing to translation

Please look at /translations/README.md

IRC

#nyaapantsu@irc.rizon.net

#nyaapantsu-dev@irc.rizon.net (Serious buisness only)

Disclaimer

We take no legal responsibility for anything this code is used for. This is purely an educational proof of concept.