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

Fixes & improvements (#1684)

* Update main.css

* Update torrent_item.jet.html

* Update main.js

* Update torrent_item.jet.html

* Update main.js

* Update main.js

* Update main.js

* Update main.js

* Update main.js

* Update template_functions_test.go

* Update template_functions_test.go

* Update user.go

* Update profile.jet.html

* Update view.jet.html

* Update template_functions.go

* Update en-us.all.json

* Add files via upload

* Update CHANGELOG.md

* Update main.css

* Update template_functions.go

* Add files via upload

* Update en-us.all.json

* Update template_functions_test.go

* Update view.jet.html

* Update main.css

* Update ja-jp.all.json

* Update main.css

* Update edit.jet.html

* Update main.css

* Update tomorrow.css

* Update ja-jp.all.json

* Update main.css

* Update view.jet.html

* Update comment.go

* Update create.go

* Update classic.css

* Make GetOldNavFromRequest return true by default

* Update view.jet.html

* Force torrent date in UTC+0 timezone during display

* ditto

* Update ja-jp.all.json

* Update oldNav.jet.html

* Update structs.go

* Update default_config.yml

* Update torrent.go

* Update stats.go

* Update stats.go

* Update user.go

* Update template_functions.go

* Update template_functions_test.go

* Update torrent.go

* Update comment.go

* Update view.jet.html

* Update main.css

* Update user.go

* Update template_functions.go

* Update profile.jet.html

* Update main.js
Cette révision appartient à :
kilo 2017-10-28 18:28:59 +02:00 révisé par GitHub
Parent a4e785ac89
révision dd94402f04
Signature inconnue de Forgejo
ID de la clé GPG: 4AEE18F83AFDEB23
42 fichiers modifiés avec 42837 ajouts et 42748 suppressions

Voir le fichier

@ -46,6 +46,14 @@ scraper:
interval: 3600
trackers:
- {url: "udp://tracker.coppersurfer.tk:6969/", name: coppersurfer.tk}
# StatScrapingFrequency : On-demand stat scraping JS will only be loaded if the stats have been scraped X hours ago or higher
stat_scraping_frequency: 48
# StatScrapingFrequencyUnknown : On-demand stat scraping for unknown torrents JS will only be loaded if the stats have been scraped X hours ago or higher
stat_scraping_frequency_unknown: 1
# MaxStatScrapingFrequency : On-demand stat scraping can only be called every X minutes, to prevent abuse of the /stats/:id route
max_stat_scraping_frequency: 5
# MaxStatScrapingFrequencyUnknown : On-demand stat scraping for unknown torrents can only be called every X minutes
max_stat_scraping_frequency_unknown: 2
# Config by default for the cache
cache:
dialect: nop

Voir le fichier

@ -38,6 +38,8 @@ type Config struct {
I18n I18nConfig `json:"i18n" yaml:"i18n,flow,omitempty"`
// torrents config
Torrents TorrentsConfig `yaml:"torrents,flow,omitempty"`
// upload config
Upload UploadConfig `json:"upload" yaml:"upload,flow,omitempty"`
// user config
Users UsersConfig `yaml:"users,flow,omitempty"`
// navigation config
@ -105,17 +107,21 @@ type I18nConfig struct {
// ScrapeConfig : Config struct for Scraping
type ScrapeConfig struct {
URL string `json:"scrape_url" yaml:"url,omitempty"`
Name string `json:"name" yaml:"name,omitempty"`
IntervalSeconds int64 `json:"interval" yaml:"interval,omitempty"`
URL string `json:"scrape_url" yaml:"url,omitempty"`
Name string `json:"name" yaml:"name,omitempty"`
IntervalSeconds int64 `json:"interval" yaml:"interval,omitempty"`
}
// ScraperConfig : Config struct for Scraper
type ScraperConfig struct {
Addr string `json:"bind" yaml:"addr,omitempty"`
NumWorkers int `json:"workers" yaml:"workers,omitempty"`
IntervalSeconds int64 `json:"default_interval" yaml:"default_interval,omitempty"`
Trackers []ScrapeConfig `json:"trackers" yaml:"trackers,omitempty"`
Addr string `json:"bind" yaml:"addr,omitempty"`
NumWorkers int `json:"workers" yaml:"workers,omitempty"`
IntervalSeconds int64 `json:"default_interval" yaml:"default_interval,omitempty"`
Trackers []ScrapeConfig `json:"trackers" yaml:"trackers,omitempty"`
StatScrapingFrequency float64 `json:"stat_scraping_frequency" yaml:"stat_scraping_frequency,omitempty"`
StatScrapingFrequencyUnknown float64 `json:"stat_scraping_frequency_unknown" yaml:"stat_scraping_frequency_unknown,omitempty"`
MaxStatScrapingFrequency float64 `json:"max_stat_scraping_frequency" yaml:"max_stat_scraping_frequency,omitempty"`
MaxStatScrapingFrequencyUnknown float64 `json:"max_stat_scraping_frequency_unknown" yaml:"max_stat_scraping_frequency_unknown,omitempty"`
}
// TrackersConfig ; Config struct for Trackers
@ -135,15 +141,22 @@ type TorrentsConfig struct {
FileStorage string `yaml:"filestorage,omitempty"`
StorageLink string `yaml:"storage_link,omitempty"`
CacheLink string `yaml:"cache_link,omitempty"`
UploadsDisabled bool `yaml:"uploads_disabled,omitempty"`
AdminsAreStillAllowedTo bool `yaml:"admins_are_still_allowed_to,omitempty"`
TrustedUsersAreStillAllowedTo bool `yaml:"trusted_users_are_still_allowed_to,omitempty"`
Trackers TrackersConfig `yaml:"trackers,flow,omitempty"`
Order string `yaml:"order,omitempty"`
Sort string `yaml:"sort,omitempty"`
Tags Tags `yaml:"tags,flow,omitempty"`
}
// UploadConfig : Config struct for uploading torrents
type UploadConfig struct {
DefaultAnidexToken string `yaml:"anidex_api_token,omitempty"`
DefaultNyaasiToken string `yaml:"nyaasi_api_token,omitempty"`
DefaultTokyoTToken string `yaml:"tokyot_api_token,omitempty"`
UploadsDisabled bool `yaml:"uploads_disabled,omitempty"`
AdminsAreStillAllowedTo bool `yaml:"admins_are_still_allowed_to,omitempty"`
TrustedUsersAreStillAllowedTo bool `yaml:"trusted_users_are_still_allowed_to,omitempty"`
}
// UsersConfig : Config struct for Users
type UsersConfig struct {
DefaultUserSettings map[string]bool `yaml:"default_notifications_settings,flow,omitempty"`

Voir le fichier

@ -35,6 +35,11 @@ func PostCommentHandler(c *gin.Context) {
}
}
content := sanitize.Sanitize(c.PostForm("comment"), "comment")
userID := currentUser.ID
if c.PostForm("anonymous") == "true" {
userID = 0
}
if strings.TrimSpace(content) == "" {
messages.AddErrorT("errors", "comment_empty")
@ -44,7 +49,7 @@ func PostCommentHandler(c *gin.Context) {
}
if !messages.HasErrors() {
_, err := comments.Create(content, torrent, currentUser)
_, err := comments.Create(content, torrent, userID)
if err != nil {
messages.Error(err)
}

Voir le fichier

@ -19,13 +19,28 @@ func GetStatsHandler(c *gin.Context) {
if err != nil {
return
}
torrent, err := torrents.FindRawByID(uint(id))
if err != nil {
return
}
var CurrentData models.Scrape
statsExists := !(models.ORM.Where("torrent_id = ?", id).Find(&CurrentData).RecordNotFound())
if statsExists {
//Stats already exist, we check if the torrent stats have been scraped already very recently and if so, we stop there to avoid abuse of the /stats/:id route
if (CurrentData.Seeders == 0 && CurrentData.Leechers == 0 && CurrentData.Completed == 0) && time.Since(CurrentData.LastScrape).Minutes() <= config.Get().Scrape.MaxStatScrapingFrequencyUnknown {
//Unknown stats but has been scraped less than X minutes ago (X being the limit set in the config file)
return
}
if (CurrentData.Seeders != 0 || CurrentData.Leechers != 0 || CurrentData.Completed != 0) && time.Since(CurrentData.LastScrape).Minutes() <= config.Get().Scrape.MaxStatScrapingFrequency {
//Known stats but has been scraped less than X minutes ago (X being the limit set in the config file)
return
}
}
var Trackers []string
if len(Trackers) > 3 {
for _, line := range strings.Split(torrent.Trackers[3:], "&tr=") {
@ -63,8 +78,7 @@ func GetStatsHandler(c *gin.Context) {
stats.Seeders = 0
}
var CurrentData models.Scrape
if models.ORM.Where("torrent_id = ?", id).Find(&CurrentData).RecordNotFound() {
if !statsExists {
torrent.Scrape = torrent.Scrape.Create(uint(id), uint32(stats.Seeders), uint32(stats.Leechers), uint32(stats.Completed), time.Now())
//Create entry in the DB because none exist
} else {

Voir le fichier

@ -26,6 +26,7 @@ type CommentJSON struct {
Username string `json:"username"`
UserID int `json:"user_id"`
UserAvatar string `json:"user_avatar"`
UserStatus string `json:"user_status"`
Content template.HTML `json:"content"`
Date time.Time `json:"date"`
}

Voir le fichier

@ -7,8 +7,8 @@ import (
"github.com/NyaaPantsu/nyaa/utils/cache"
)
func Create(content string, torrent *models.Torrent, user *models.User) (*models.Comment, error) {
comment := &models.Comment{TorrentID: torrent.ID, UserID: user.ID, Content: content, CreatedAt: time.Now()}
func Create(content string, torrent *models.Torrent, userID uint) (*models.Comment, error) {
comment := &models.Comment{TorrentID: torrent.ID, UserID: userID, Content: content, CreatedAt: time.Now()}
err := models.ORM.Create(comment).Error
if err != nil {
return comment, err

Voir le fichier

@ -300,11 +300,21 @@ func (t *Torrent) ToJSON() TorrentJSON {
magnet := format.InfoHashToMagnet(strings.TrimSpace(t.Hash), t.Name, trackers...)
commentsJSON := make([]CommentJSON, 0, len(t.OldComments)+len(t.Comments))
for _, c := range t.OldComments {
commentsJSON = append(commentsJSON, CommentJSON{Username: c.Username, UserID: -1, Content: template.HTML(c.Content), Date: c.Date.UTC()})
commentsJSON = append(commentsJSON, CommentJSON{Username: c.Username, UserID: -1, UserStatus: "", 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: sanitize.MarkdownToHTML(c.Content), Date: c.CreatedAt.UTC(), UserAvatar: c.User.MD5})
userStatus := ""
if c.User.IsBanned() {
userStatus = "userstatus_banned"
}
if c.User.HasAdmin() {
userStatus = "userstatus_moderator"
}
if c.User.ID == t.ID {
userStatus = "userstatus_uploader"
}
commentsJSON = append(commentsJSON, CommentJSON{Username: c.User.Username, UserID: int(c.User.ID), UserStatus: userStatus, Content: sanitize.MarkdownToHTML(c.Content), Date: c.CreatedAt.UTC(), UserAvatar: c.User.MD5})
} else {
commentsJSON = append(commentsJSON, CommentJSON{})
}
@ -357,7 +367,7 @@ func (t *Torrent) ToJSON() TorrentJSON {
statsObsolete[0] = true
//The displayed stats are obsolete, S/D/L will show "Unknown"
}
if time.Since(scrape.LastScrape).Hours() > 730 || (scrape.Seeders == 0 && scrape.Leechers == 0 && scrape.Completed == 0 && time.Since(scrape.LastScrape).Hours() >= 1) {
if time.Since(scrape.LastScrape).Hours() > config.Get().Scrape.StatScrapingFrequency || (scrape.Seeders == 0 && scrape.Leechers == 0 && scrape.Completed == 0 && time.Since(scrape.LastScrape).Hours() >= config.Get().Scrape.StatScrapingFrequencyUnknown) {
statsObsolete[1] = true
//The stats need to be refreshed, either because they are valid and older than one month (not that reliable) OR if they are unknown but have been scraped 1h (or more) ago
}
@ -369,8 +379,8 @@ func (t *Torrent) ToJSON() TorrentJSON {
Status: t.Status,
Hidden: t.Hidden,
Hash: t.Hash,
Date: t.Date.Format(time.RFC3339),
FullDate: t.Date,
Date: t.Date.UTC().Format(time.RFC3339),
FullDate: t.Date.UTC(),
Filesize: t.Filesize,
Description: sanitize.MarkdownToHTML(t.Description),
Comments: commentsJSON,

Voir le fichier

@ -180,11 +180,11 @@ func (u *User) NeedsCaptcha() bool {
// CanUpload : Check if a user can upload or if upload is enabled in config
func (u *User) CanUpload() bool {
if config.Get().Torrents.UploadsDisabled {
if config.Get().Torrents.AdminsAreStillAllowedTo && u.IsModerator() {
if config.Get().Upload.UploadsDisabled {
if config.Get().Upload.AdminsAreStillAllowedTo && u.IsModerator() {
return true
}
if config.Get().Torrents.TrustedUsersAreStillAllowedTo && u.IsTrusted() {
if config.Get().Upload.TrustedUsersAreStillAllowedTo && u.IsTrusted() {
return true
}
return false
@ -196,17 +196,17 @@ func (u *User) CanUpload() bool {
func (u *User) GetRole() string {
switch u.Status {
case UserStatusBanned:
return "Banned"
return "userstatus_banned"
case UserStatusMember:
return "Member"
return "userstatus_member"
case UserStatusScraped:
return "Member"
return "userstatus_scraped"
case UserStatusTrusted:
return "Trusted Member"
return "userstatus_trusted"
case UserStatusModerator:
return "Moderator"
return "userstatus_moderator"
}
return "Member"
return "userstatus_member"
}
// IsFollower : Check if a user is following another

Voir le fichier

@ -341,6 +341,17 @@ select.form-input {
max-height: 100%;
}
.user-avatar span {
position: absolute;
color: #292929;
background: #fd6b6b;
padding: 1px 4px;
border-radius: 7px;
font-size: 10px;
top: 37px;
right: 19px;
}
#content {
position: relative;
}
@ -857,7 +868,7 @@ html, body {
@media (max-width: 810px) {
body {
margin: 8px 0;
margin: 0 0 8px;
}
.torrent-info-row>td {
display: block;
@ -934,10 +945,6 @@ html, body {
height: 57px;
}
#content {
top: 58px;
}
h3 {
margin-bottom: 5px;
}
@ -1175,6 +1182,22 @@ html, body {
margin-bottom: 8px;
}
.comment-box span+p span::before {
content: '(';
}
.comment-box span+p span::after {
content: ')';
}
.comment-box span+p span {
font-size: 12px;
font-style: italic;
margin-left: 4px;
}
.comment-content :last-child {
margin-bottom: 2px;
}
.comment-form {
margin-left: 10px;
margin-top: 10px;
@ -1182,6 +1205,10 @@ html, body {
padding-bottom: 5px;
}
.comment-form h3 {
margin-bottom: 8px;
}
.comment-index {
margin-right: 5px;
margin-top: 5px;
@ -1487,6 +1514,9 @@ input.filelist-checkbox:checked+table.table-filelist {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.modal-body :first-child {
margin-top: 0;
}
/* Modal Footer */
@ -2251,7 +2281,7 @@ form.delete-form button.form-input.btn-red {
}
.user-torrent-table {
margin-bottom: 80px
margin-bottom: 80px
}
.user-torrent-search {

Voir le fichier

@ -311,7 +311,7 @@ select.form-input {
border-radius: 5px;
margin: 0 0 4px 0;
padding: 4px;
min-height: 70px;
min-height: 66px;
}
span.comment-index+p {

Voir le fichier

@ -60,6 +60,9 @@ a:hover {
background: #99BFD0;
border-color: #282A2E;
}
.user-avatar span {
background-color: #d02727;
}
.header .h-user .user-menu {
background: #282A2E;

Voir le fichier

@ -55,40 +55,35 @@ function parseAllDates() {
month: "short",
day: "numeric"
}
var hmOpt = {
hour: "numeric",
minute: "numeric"
}
var list = document.getElementsByClassName("date-short")
for(var i = 0; i < list.length; i++) {
var e = list[i]
e.innerText = new Date(e.title).toLocaleString(lang, ymdOpt)
e.title = new Date(e.title).toLocaleString(lang)
e.classList.remove("date-short")
}
var list = document.getElementsByClassName("date-full")
for(var i = 0; i < list.length; i++) {
var e = list[i]
var dateDifference = dateDiff(new Date(e.innerText), new Date())
if(e.classList.contains("scrape-date"))
e.title = hmFmt.format((dateDifference.d * 24) + dateDifference.h, dateDifference.m)
else
e.title = dhFmt.format(dateDifference.d, dateDifference.h)
e.innerText = new Date(e.innerText).toLocaleString(lang)
e.classList.remove("date-full")
}
}
function dateDiff( str1, str2 ) {
var diff = Date.parse( str2 ) - Date.parse( str1 );
return isNaN( diff ) ? NaN : {
diff : diff,
m : Math.floor( diff / 60000 % 60 ),
h : Math.floor( diff / 3600000 % 24 ),
d : Math.floor( diff / 86400000 )
s : Math.floor( diff / 1000 ),
m : Math.floor( diff / 60000 % 60 ),
h : Math.floor( diff / 3600000 % 24 ),
d : Math.floor( diff / 86400000 )
};
}
parseAllDates()

Voir le fichier

@ -1,7 +1,7 @@
<div class="box refine website-nav">
<table id="nav-category-list">
<tbody>
<tr><td>{{if Search.Category == ""}}<b>{{ T("all_categories")}}</b>{{else}}<a href="{{genSearchWithCategory(URL, "_", Search.SearchURL)}}">{{ T("all_categories")}}</a>{{end}}</td></tr>
<tr><td colspan="3">{{if Search.Category == ""}}<b>{{ T("all_categories")}}</b>{{else}}<a href="{{genSearchWithCategory(URL, "_", Search.SearchURL)}}">{{ T("all_categories")}}</a>{{end}}</td></tr>
<tr>
{{ range _, cat := GetCategories(true, false) }}
<td>{{if Search.Category == cat.ID ||(len(Search.Category) > 2 && Search.Category[:2] == cat.ID)}}<b>{{ T(cat.Name) }}</b>{{else}}<a href="{{genSearchWithCategory(URL, cat.ID, Search.SearchURL)}}">{{ T(cat.Name) }}</a>{{end}}</td>

Voir le fichier

@ -11,7 +11,7 @@
{{ UserProfile.Username}}
</p>
<p class="profile-usertitle-job">
{{UserProfile.GetRole()}}
{{T(UserProfile.GetRole())}}
</p>
<p class="profile-usertitle-uploadcount">{{ T("torrents_uploaded") }}:<span>{{ NbTorrents }}</span></p>
</div>

Voir le fichier

@ -64,7 +64,7 @@ Templates.Add("torrents.item", function(torrent) {
<td class="tr-se home-td hide-smol">` + stats[0] + `</td>
<td class="tr-le home-td hide-smol">` + stats[1] + `</td>
<td class="tr-dl home-td hide-xs">` + stats[2] + `</td>
<td class="tr-date home-td date-short hide-xs">` + torrent.date + `</td>
<td class="tr-date home-td date-short hide-xs" title="` + torrent.date + `">` + torrent.date + `</td>
</tr>`;
});
</script>

Voir le fichier

@ -102,7 +102,7 @@
<td class="tr-le home-td hide-smol">{{.Leechers}}</td>
<td class="tr-dl home-td hide-xs">{{.Completed}}</td>
{{end}}
<td class="tr-date home-td date-short hide-xs" title="{{.Date}}">{{formatDate(.FullDate, true)}}</td>
<td class="tr-date home-td date-short hide-xs" title="{{formatDate(.FullDate, false)}}">{{formatDate(.FullDate, true)}}</td>
</tr>
{{end}}
</tbody>

Voir le fichier

@ -154,14 +154,14 @@
<form method="POST" action="/mod/torrent/delete" class="delete-form">
{{ yield csrf_field()}}
<input type="hidden" name="id" value="{{ Torrent.ID }}">
<button type="submit" class="form-input btn-red" onclick="if (!confirm('{{ T(" are_you_sure ") }}{{ T("delete") }}')) return false;"><i class="icon-trash"></i>{{ T("delete") }}</button>
<button type="submit" class="form-input btn-red" onclick="if (!confirm('{{ T("are_you_sure") }}{{ T("delete") }}')) return false;"><i class="icon-trash"></i>{{ T("delete") }}</button>
</form>
<a href="/mod/torrent?id={{ Torrent.ID }}" class="form-input btn-orange">{{ T("edit") }}</a>
{{ else if User.CurrentUserIdentical(Torrent.UploaderID) }}
<form method="POST" action="/torrent/delete" class="delete-form">
{{ yield csrf_field()}}
<input type="hidden" name="id" value="{{ Torrent.ID }}">
<button type="submit" class="form-input btn-red" onclick="if (!confirm('{{ T(" are_you_sure ") }}{{ T("delete") }}')) return false;"><i class="icon-trash"></i>{{ T("delete") }}</button>
<button type="submit" class="form-input btn-red" onclick="if (!confirm('{{ T("are_you_sure") }}{{ T("delete") }}')) return false;"><i class="icon-trash"></i>{{ T("delete") }}</button>
</form>
<a href="/torrent?id={{ Torrent.ID }}" class="form-input btn-orange">{{ T("edit") }}</a>
{{end}}
@ -206,8 +206,10 @@
<a href="#comment_{{idx}}">{{idx}}</a>
<small style="padding-left: 4px;" class="date-short" title="{{formatDateRFC(element.Date)}}">{{formatDate(element.Date, false)}}</small>
</span>
<p><img src="https://www.gravatar.com/avatar/{{ element.UserAvatar }}"/><a {{if element.UserID > 0}}href="/user/{{element.UserID}}/{{element.Username}}"{{end}} class="comment-user">{{if element.Username == ""}}れんちょん{{else}}{{element.Username}}{{end}}</a></p>
<p class="comment-content">{{element.Content|raw}}</p>
<p><img src="https://www.gravatar.com/avatar/{{ element.UserAvatar }}"/>
{{if element.UserID > 0}}<a href="/user/{{element.UserID}}/{{element.Username}}" class="comment-user">{{element.Username}}</a><span>{{if element.UserStatus != ""}}{{T(element.UserStatus)}}{{end}}</span>{{else}}
<span>れんちょん</span>{{end}}
<div class="comment-content">{{element.Content|raw}}</div>
</div>
{{idx = idx + 1}}
{{end}}
@ -229,6 +231,7 @@
{{ yield captcha(captchaid=CaptchaID)}}
</div>
<button type="submit" class="form-input up-btn">{{ T("submit") }}</button>
{{if User.ID > 0}}<input type="checkbox" name="anonymous" value="true" id="anonymous"><label for="anonymous">{{ T("submit_a_comment_as_anonymous")}}</label>{{end}}
</div>
</form>
</div>

Voir le fichier

@ -240,13 +240,13 @@
<td><label for="status">{{ T("role") }}:</label></td>
<td>
<select id="status" name="status" class="form-input up-input">
<option value="-1" {{ if UserProfile.Status == -1 }}selected{{end}}>{{ T("banned")}}</option>
<option value="0" {{ if UserProfile.Status == 0 }}selected{{end}}>{{ T("member")}} ({{ T("default") }})</option>
<option value="1" {{ if UserProfile.Status == 1 }}selected{{end}}>{{ T("trusted_member")}}</option>
<option value="-1" {{ if UserProfile.Status == -1 }}selected{{end}}>{{ T("userstatus_banned")}}</option>
<option value="0" {{ if UserProfile.Status == 0 }}selected{{end}}>{{ T("userstatus_member")}} ({{ T("default") }})</option>
<option value="1" {{ if UserProfile.Status == 1 }}selected{{end}}>{{ T("userstatus_trusted")}}</option>
{{ if UserProfile.Status == 2}}
<option value="2" selected>{{ T("moderator")}}</option>
<option value="2" selected>{{ T("userstatus_moderator")}}</option>
{{end}}
<option value="3" {{ if UserProfile.Status == 3 }}selected{{end}}>{{ T("scraped_user")}}</option>
<option value="3" {{ if UserProfile.Status == 3 }}selected{{end}}>{{ T("userstatus_scraped")}}</option>
</select>
</td>
</tr>

Voir le fichier

@ -60,6 +60,8 @@
* + generating_torrent
## 2017/10/09
* + no_api_token
## 2017/10/19
* + userstatus_uploader
## 2017/10/28
* + hours_minutes_ago
* + days_hours_ago

Voir le fichier

@ -1,39 +1,39 @@
# Contributing to translation
You can add your own language support or edit it easily to the website.
## Add a language
To add a language you need to copy /translations/en-us.all.json and translate the strings beside the "translation" key. Do not edit "id" which is the id used to display the translation.
You can also, if you have the website installed, create an empty languageCode.all.json (eg. en-us.all.json) and use the following command:
`cd translations && goi18n -flat false en-us.all.json languageCode.all.json` you need to replace languageCode with the actual language code (eg. en-us)
A new file languageCode.untranslated.json will be created with the new translation strings. Translate them and when it's done, run the following command:
`goi18n -flat=false en-us.all.json languageCode.all.json languageCode.untranslated.json` you need to replace languageCode with the actual language code (eg. en-us)
After creating a new translation, create a new translation string inside "en-us.all.json", like the following:
```
...
},
{
"id": "language_(languageCode)_name",
"translation": "(your language name, in English)"
},
...
```
where languageCode is the newly created ISO code (eg. ja-jp, pt-br).
Before pulling, be sure to delete .unstranslated.json file
## Edit a language
To edit a language you can keep tracking of new strings added to en-us.all.json with the use of git and add the new strings manually to your file.
Or you can also, if you have the website installed, use the following command:
`cd translations && goi18n -flat false en-us.all.json languageCode.all.json` you need to replace languageCode with the actual language code (eg. en-us)
A new file languageCode.untranslated.json will be created with the new translation strings. Translate them and when it's done, run the following command:
`goi18n -flat=false en-us.all.json languageCode.all.json languageCode.untranslated.json` you need to replace languageCode with the actual language code (eg. en-us)
Before pulling, be sure to delete .unstranslated.json file
# Contributing to translation
You can add your own language support or edit it easily to the website.
## Add a language
To add a language you need to copy /translations/en-us.all.json and translate the strings beside the "translation" key. Do not edit "id" which is the id used to display the translation.
You can also, if you have the website installed, create an empty languageCode.all.json (eg. en-us.all.json) and use the following command:
`cd translations && goi18n -flat false en-us.all.json languageCode.all.json` you need to replace languageCode with the actual language code (eg. en-us)
A new file languageCode.untranslated.json will be created with the new translation strings. Translate them and when it's done, run the following command:
`goi18n -flat=false en-us.all.json languageCode.all.json languageCode.untranslated.json` you need to replace languageCode with the actual language code (eg. en-us)
After creating a new translation, create a new translation string inside "en-us.all.json", like the following:
```
...
},
{
"id": "language_(languageCode)_name",
"translation": "(your language name, in English)"
},
...
```
where languageCode is the newly created ISO code (eg. ja-jp, pt-br).
Before pulling, be sure to delete .unstranslated.json file
## Edit a language
To edit a language you can keep tracking of new strings added to en-us.all.json with the use of git and add the new strings manually to your file.
Or you can also, if you have the website installed, use the following command:
`cd translations && goi18n -flat false en-us.all.json languageCode.all.json` you need to replace languageCode with the actual language code (eg. en-us)
A new file languageCode.untranslated.json will be created with the new translation strings. Translate them and when it's done, run the following command:
`goi18n -flat=false en-us.all.json languageCode.all.json languageCode.untranslated.json` you need to replace languageCode with the actual language code (eg. en-us)
Before pulling, be sure to delete .unstranslated.json file

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Voir le fichier

@ -212,13 +212,13 @@ func GetAltColorsFromRequest(c *gin.Context) bool {
func GetOldNavFromRequest(c *gin.Context) bool {
user, _ := getCurrentUser(c)
if user.ID > 0 {
return user.OldNav == "true"
return user.OldNav != "false"
}
cookie, err := c.Cookie("oldNav")
if err == nil {
return cookie == "true"
return cookie != "false"
}
return false
return true
}
// GetMascotFromRequest : Return whether user has enabled mascot or not