Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0
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.
nyaa-pantsu/README.md

96 lignes
3.3 KiB
Markdown
Brut Lien permanent Vue normale Historique

![nyanpasu~](https://git.dess.ga/Albirew/nyaa-pantsu/raw/branch/dev/.gitea/aglaxe.png)
2017-05-06 07:05:14 +02:00
# Nyaa replacement
2017-05-03 05:46:14 +02:00
## Motivation
The aim of this project was to write a fully featured nyaa replacement in golang
2017-05-03 05:46:14 +02:00
that anyone will be able to deploy locally or remotely.
## Roadmap
RIP in piss.
2017-05-14 03:14:27 +02:00
2017-05-03 05:46:14 +02:00
# Requirements
2017-07-23 03:37:48 +02:00
* Golang ![golang](https://git.dess.ga/Albirew/nyaa-pantsu/raw/branch/dev/.gitea/golangirl.png)
2017-05-03 05:46:14 +02:00
2017-05-05 00:26:59 +02:00
# Installation
All tested versions of Ubuntu fail to build, use a different OS or docker
* Install [Golang](https://golang.org/doc/install) (version >=1.8)
* `go get -u github.com/tools/godep`
2017-05-17 07:58:40 +02:00
* `go get github.com/NyaaPantsu/nyaa`
Torrent Generation on not found error (#1600) * [WIP] Torrent Generation on not found error As asked in #1517, it allows on-the-fly torrent generation. Since it uses magnet links, it needs some time to connect to peers. So it can't be instant generation, we need the user to wait and try after a minute at least. * Replace Fatal by simple error * attempt at fixing travis * del * Add Anacrolyx dependency * Add back difflib * Remove .torrent suffix in the url example * Add some explanations when file missing page shown * Ignore downloads directory * Either use cache (third-party site) or own download directory * Wrong import * If there is an error then it means we aren't generating a torrent file May it be "torrent not found" or "We do not store torrent files" which are the two only existing errors for this page * hash is never empty * TorrentLink may be empty at times So we add a /download/:hash link if it is * Update README.md * Made a mistake here, need to check if false * Update en-us.all.json * Update CHANGELOG.md * Torrent file generation can be triggered by click on button if JS enabled * Update download.go * Update download.go * Use c.JSON instead of text/template * Return to default behavior if we don't generate the file * Don't do the query if returned to default behavior * Add "Could not generate torrent file" error * Fix JS condition & lower delay until button updates * Start download automatically once torrent file is generated * Fix torrentFileExists() constantly returning false if external torrent download URL * torrent-view-data is two tables instead of one This allows the removal of useless things without any problem (e.g Website link), but also a better responsibe design since the previous one separated stats after a certain res looking very wonky * CSS changes to go along * Remove useless <b></b> * Update main.css * In torrentFileExists, check if filestorage path exists instead of looking at the domain in torrent link When checking if the file is stored on another server i used to simply check if the domain name was inside the torrent link, but we can straight up check for filestorage length * Fix JS of on-demand stat fetching * ScrapeAge variable accessible through view.jet.html Contains last scraped time in hours, is at -1 is torrent has never been scraped Stats will get updated if it's either at -1 or above 1460 (2 months old) * Refresh stats if older than two months OR unknown and older than 24h Show last scraped date even if stats are unknown * Add StatsObsolete variable to torrent Indicating if: - They can be shown - They need to be updated * Update scraped data even if Unknown, prevent users from trying to fetch stats every seconds * Torrent file stored locally by default * no need to do all of that if no filestorage * fix filestorage path * Fix torrent download button stuck on "Generating torrent file" at rare times * fix some css rules that didn't work on IE * Fix panic error Seems like this error is a known bug from anacrolyx torrent https://github.com/anacrolix/torrent/issues/83 To prevent it, I'm creating a single client and modifying the socket.go to make it not raise a panic but a simple error log.
2017-10-21 09:40:43 +02:00
On Windows, a specific version of GCC is used to build a specific depedency we use
The GCC version packaged with [msys2](https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2) should work
2017-05-31 18:07:58 +02:00
Torrent Generation on not found error (#1600) * [WIP] Torrent Generation on not found error As asked in #1517, it allows on-the-fly torrent generation. Since it uses magnet links, it needs some time to connect to peers. So it can't be instant generation, we need the user to wait and try after a minute at least. * Replace Fatal by simple error * attempt at fixing travis * del * Add Anacrolyx dependency * Add back difflib * Remove .torrent suffix in the url example * Add some explanations when file missing page shown * Ignore downloads directory * Either use cache (third-party site) or own download directory * Wrong import * If there is an error then it means we aren't generating a torrent file May it be "torrent not found" or "We do not store torrent files" which are the two only existing errors for this page * hash is never empty * TorrentLink may be empty at times So we add a /download/:hash link if it is * Update README.md * Made a mistake here, need to check if false * Update en-us.all.json * Update CHANGELOG.md * Torrent file generation can be triggered by click on button if JS enabled * Update download.go * Update download.go * Use c.JSON instead of text/template * Return to default behavior if we don't generate the file * Don't do the query if returned to default behavior * Add "Could not generate torrent file" error * Fix JS condition & lower delay until button updates * Start download automatically once torrent file is generated * Fix torrentFileExists() constantly returning false if external torrent download URL * torrent-view-data is two tables instead of one This allows the removal of useless things without any problem (e.g Website link), but also a better responsibe design since the previous one separated stats after a certain res looking very wonky * CSS changes to go along * Remove useless <b></b> * Update main.css * In torrentFileExists, check if filestorage path exists instead of looking at the domain in torrent link When checking if the file is stored on another server i used to simply check if the domain name was inside the torrent link, but we can straight up check for filestorage length * Fix JS of on-demand stat fetching * ScrapeAge variable accessible through view.jet.html Contains last scraped time in hours, is at -1 is torrent has never been scraped Stats will get updated if it's either at -1 or above 1460 (2 months old) * Refresh stats if older than two months OR unknown and older than 24h Show last scraped date even if stats are unknown * Add StatsObsolete variable to torrent Indicating if: - They can be shown - They need to be updated * Update scraped data even if Unknown, prevent users from trying to fetch stats every seconds * Torrent file stored locally by default * no need to do all of that if no filestorage * fix filestorage path * Fix torrent download button stuck on "Generating torrent file" at rare times * fix some css rules that didn't work on IE * Fix panic error Seems like this error is a known bug from anacrolyx torrent https://github.com/anacrolix/torrent/issues/83 To prevent it, I'm creating a single client and modifying the socket.go to make it not raise a panic but a simple error log.
2017-10-21 09:40:43 +02:00
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)
2017-05-05 09:15:26 +02:00
* `./nyaa`
* You can now access your local site over on [localhost:9999](http://localhost:9999)
2017-05-05 00:26:59 +02:00
## 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`
2017-05-06 07:52:58 +02:00
## Docker
We support docker for easy development and deployment. Simply install docker and
docker-compose by following the instructions [here](https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository).
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.
2017-05-10 02:32:44 +02:00
Windows Users If you get `"standard_init_linux.go:178: exec user process caused "no such file or directory"`
download [dos2unix](https://sourceforge.net/projects/dos2unix/files/latest/download) and run "dos2unix.exe"
on the /deploy/init.sh to convert CR+LF to LF.
2017-05-06 07:52:58 +02:00
```sh
2017-05-17 07:58:40 +02:00
# Make sure the project is in here $GOPATH/src/github.com/NyaaPantsu/nyaa
2017-05-06 07:52:58 +02:00
$ 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
2017-05-06 07:52:58 +02:00
```
2017-05-06 07:55:55 +02:00
Access the website by going to [localhost:9999](http://localhost:9999).
2017-05-06 07:52:58 +02:00
2017-05-07 01:23:25 +02:00
> For postgres, place the dump in the toplevel directory and name it to
> nyaa_psql.backup.
2017-05-03 05:46:14 +02:00
# LICENSE
This project is licensed under the MIT License - see the LICENSE.md file for details
2017-05-17 03:28:35 +02:00
# Contributing
Use tabs for css and js files.
2017-06-16 19:44:39 +02:00
# Contributing to translation
Please look at /translations/README.md
2017-05-17 03:28:35 +02:00
# Disclaimer
We take no legal responsibility for anything this code is used for. This is purely an educational proof of concept.
![screenshot~](https://git.dess.ga/Albirew/nyaa-pantsu/raw/branch/dev/.gitea/screenshot.png)