Allow marking uploads as remake
Cette révision appartient à :
Parent
64473e68ad
révision
d98d918301
5 fichiers modifiés avec 20 ajouts et 12 suppressions
|
@ -28,6 +28,7 @@ type UploadForm struct {
|
|||
Name string
|
||||
Magnet string
|
||||
Category string
|
||||
Remake bool
|
||||
Description string
|
||||
captcha.Captcha
|
||||
|
||||
|
@ -40,19 +41,12 @@ type UploadForm struct {
|
|||
|
||||
// TODO: these should be in another package (?)
|
||||
|
||||
// form value for torrent name
|
||||
// form names
|
||||
const UploadFormName = "name"
|
||||
|
||||
// form value for torrent file
|
||||
const UploadFormTorrent = "torrent"
|
||||
|
||||
// form value for magnet uri (?)
|
||||
const UploadFormMagnet = "magnet"
|
||||
|
||||
// form value for category
|
||||
const UploadFormCategory = "c"
|
||||
|
||||
// form value for description
|
||||
const UploadFormRemake = "remake"
|
||||
const UploadFormDescription = "desc"
|
||||
|
||||
// error indicating that you can't send both a magnet link and torrent
|
||||
|
@ -84,6 +78,7 @@ func (f *UploadForm) ExtractInfo(r *http.Request) error {
|
|||
f.Category = r.FormValue(UploadFormCategory)
|
||||
f.Description = r.FormValue(UploadFormDescription)
|
||||
f.Magnet = r.FormValue(UploadFormMagnet)
|
||||
f.Remake = r.FormValue(UploadFormRemake) == "on"
|
||||
f.Captcha = captcha.Extract(r)
|
||||
|
||||
if !captcha.Authenticate(f.Captcha) {
|
||||
|
|
|
@ -34,7 +34,9 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||
fmt.Printf("error %+v\n", err)
|
||||
}
|
||||
status := 1 // normal
|
||||
if user.Status == 1 {
|
||||
if uploadForm.Remake { // overrides trusted
|
||||
status = 2
|
||||
} else if user.Status == 1 {
|
||||
status = 3 // mark as trusted if user is trusted
|
||||
}
|
||||
//add to db and redirect depending on result
|
||||
|
|
|
@ -40,7 +40,10 @@
|
|||
<option value="1_1" {{if eq .Category "1_1"}}selected{{end}}>{{T "software_applications"}}</option>
|
||||
<option value="1_2" {{if eq .Category "1_2"}}selected{{end}}>{{T "software_games"}}</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="checkbox" name="remake">
|
||||
<label for="remake">{{T "mark_as_remake"}}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
},
|
||||
{
|
||||
"id":"confirm_password",
|
||||
"translation": "Bestätige dein Passwort"
|
||||
"translation": "Passwort-Bestätigung"
|
||||
},
|
||||
{
|
||||
"id":"i_agree",
|
||||
|
@ -566,5 +566,9 @@
|
|||
{
|
||||
"id": "moderation",
|
||||
"translation": "Moderation"
|
||||
},
|
||||
{
|
||||
"id": "mark_as_remake",
|
||||
"translation": "Als Remake markieren"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -574,5 +574,9 @@
|
|||
{
|
||||
"id": "renchon_anon_explanation",
|
||||
"translation": "れんちょん is the username assigned to uploads and comments made anonymously. It is also used for torrent imported from the original nyaa, though the original uploader may be displayed alongside."
|
||||
},
|
||||
{
|
||||
"id": "mark_as_remake",
|
||||
"translation": "Mark as remake"
|
||||
}
|
||||
]
|
||||
|
|
Référencer dans un nouveau ticket