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

Fix most go lint warnings

Cette révision appartient à :
PantsuDev 2017-07-23 15:46:29 +10:00
Parent a931b47bff
révision d9142a73c3
54 fichiers modifiés avec 7161 ajouts et 7275 suppressions

25
.htmlhintrc Fichier normal
Voir le fichier

@ -0,0 +1,25 @@
{
"alt-require": true,
"attr-lowercase": true,
"attr-no-duplication": true,
"attr-unsafe-chars": true,
"attr-value-double-quotes": false,
"attr-value-not-empty": false,
"doctype-first": true,
"doctype-html5": true,
"head-script-disabled": true,
"href-abs-or-rel": false,
"id-class-ad-disabled": true,
"id-class-value": "dash",
"id-unique": true,
"inline-script-disabled": true,
"inline-style-disabled": true,
"space-tab-mixed-disabled": "space2",
"spec-char-escape": true,
"src-not-empty": true,
"style-disabled": true,
"tag-pair": true,
"tag-self-close": false,
"tagname-lowercase": true,
"title-require": true
}

Voir le fichier

@ -16,4 +16,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Voir le fichier

@ -1,5 +1,5 @@
define({ "api": [ define({
{ "api": [{
"type": "get", "type": "get",
"url": "/search/", "url": "/search/",
"title": "Search Torrents", "title": "Search Torrents",
@ -8,8 +8,7 @@ define({ "api": [
"group": "Torrents", "group": "Torrents",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "String[]", "type": "String[]",
"optional": false, "optional": false,
@ -133,45 +132,37 @@ define({ "api": [
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Object[]", "type": "Object[]",
"optional": false, "optional": false,
"field": "torrents", "field": "torrents",
"description": "<p>List of torrent object (see view for the properties).</p>" "description": "<p>List of torrent object (see view for the properties).</p>"
} }]
]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": " HTTP/1.1 200 OK\n {\n\t\t\t\"torrents\": [...],\n\t\t\t\"queryRecordCount\": 50,\n\t\t\t\"totalRecordCount\": 798414\n\t\t}", "content": " HTTP/1.1 200 OK\n {\n\t\t\t\"torrents\": [...],\n\t\t\t\"queryRecordCount\": 50,\n\t\t\t\"totalRecordCount\": 798414\n\t\t}",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Torrents", "groupTitle": "Torrents",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "String[]", "type": "String[]",
"optional": false, "optional": false,
"field": "errors", "field": "errors",
"description": "<p>List of errors messages with a 404 error message in it.</p>" "description": "<p>List of errors messages with a 404 error message in it.</p>"
} }]
]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -183,8 +174,7 @@ define({ "api": [
"group": "Torrents", "group": "Torrents",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "String[]", "type": "String[]",
"optional": false, "optional": false,
@ -308,45 +298,37 @@ define({ "api": [
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Object[]", "type": "Object[]",
"optional": false, "optional": false,
"field": "torrents", "field": "torrents",
"description": "<p>List of torrent object (see view for the properties).</p>" "description": "<p>List of torrent object (see view for the properties).</p>"
} }]
]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": " HTTP/1.1 200 OK\n {\n\t\t\t[...]\n\t\t}", "content": " HTTP/1.1 200 OK\n {\n\t\t\t[...]\n\t\t}",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/_apidoc.js", "filename": "controllers/api/_apidoc.js",
"groupTitle": "Torrents", "groupTitle": "Torrents",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "String[]", "type": "String[]",
"optional": false, "optional": false,
"field": "errors", "field": "errors",
"description": "<p>List of errors messages with a 404 error message in it.</p>" "description": "<p>List of errors messages with a 404 error message in it.</p>"
} }]
]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -358,21 +340,18 @@ define({ "api": [
"group": "Torrents", "group": "Torrents",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "Number", "type": "Number",
"optional": false, "optional": false,
"field": "id", "field": "id",
"description": "<p>Torrent unique ID.</p>" "description": "<p>Torrent unique ID.</p>"
} }]
]
} }
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Number", "type": "Number",
"optional": false, "optional": false,
@ -535,35 +514,29 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": " HTTP/1.1 200 OK\n\t{\n\t\"id\": 952801,\n\t\"name\": \"[HorribleSubs] Uchouten Kazoku S2 [720p]\",\n\t\"status\": 1,\n\t\"hash\": \"6E4D96F7A0B0456672E80B150CCB7C15868CD47D\",\n\t\"date\": \"2017-07-05T11:01:39Z\",\n\t\"filesize\": 4056160259,\n\t\"description\": \"<p>Unofficial batch</p>\\n\",\n\t\"comments\": [],\n\t\"sub_category\": \"5\",\n\t\"category\": \"3\",\n\t\"anidb_id\": \"\",\n\t\"downloads\": 0,\n\t\"uploader_id\": 7177,\n\t\"uploader_name\": \"DarAR92\",\n\t\"uploader_old\": \"\",\n\t\"website_link\": \"http://horriblesubs.info/\",\n\t\"languages\": [\n\t\"en-us\"\n\t],\n\t\"magnet\": \"magnet:?xt=urn:btih:6E4D96F7A0B0456672E80B150CCB7C15868CD47D&dn=%5BHorribleSubs%5D+Uchouten+Kazoku+S2+%5B720p%5D&tr=http://nyaa.tracker.wf:7777/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://tracker.doko.moe:6969&tr=http://tracker.anirena.com:80/announce&tr=http://anidex.moe:6969/announce&tr=udp://tracker.opentrackr.org:1337&tr=udp://tracker.coppersurfer.tk:6969&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://zer0day.ch:1337&tr=udp://9.rarbg.com:2710/announce&tr=udp://tracker2.christianbro.pw:6969/announce&tr=udp://tracker.coppersurfer.tk:6969&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://eddie4.nl:6969/announce&tr=udp://tracker.doko.moe:6969/announce\",\n\t\"torrent\": \"https://nyaa.pantsu.cat/download/6E4D96F7A0B0456672E80B150CCB7C15868CD47D\",\n\t\"seeders\": 4,\n\t\"leechers\": 2,\n\t\"completed\": 28,\n\t\"last_scrape\": \"2017-07-07T07:48:32.509635Z\",\n\t\"file_list\": [\n\t{\n\t\"path\": \"[HorribleSubs] Uchouten Kazoku S2 - 01[720p].mkv\",\n\t\"filesize\": 338250895\n\t},\n\t{\n\t\"path\": \"[HorribleSubs] Uchouten Kazoku S2 - 12 [720p].mkv\",\n\t\"filesize\": 338556275\n\t}\n\t]\n\t}", "content": " HTTP/1.1 200 OK\n\t{\n\t\"id\": 952801,\n\t\"name\": \"[HorribleSubs] Uchouten Kazoku S2 [720p]\",\n\t\"status\": 1,\n\t\"hash\": \"6E4D96F7A0B0456672E80B150CCB7C15868CD47D\",\n\t\"date\": \"2017-07-05T11:01:39Z\",\n\t\"filesize\": 4056160259,\n\t\"description\": \"<p>Unofficial batch</p>\\n\",\n\t\"comments\": [],\n\t\"sub_category\": \"5\",\n\t\"category\": \"3\",\n\t\"anidb_id\": \"\",\n\t\"downloads\": 0,\n\t\"uploader_id\": 7177,\n\t\"uploader_name\": \"DarAR92\",\n\t\"uploader_old\": \"\",\n\t\"website_link\": \"http://horriblesubs.info/\",\n\t\"languages\": [\n\t\"en-us\"\n\t],\n\t\"magnet\": \"magnet:?xt=urn:btih:6E4D96F7A0B0456672E80B150CCB7C15868CD47D&dn=%5BHorribleSubs%5D+Uchouten+Kazoku+S2+%5B720p%5D&tr=http://nyaa.tracker.wf:7777/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://tracker.doko.moe:6969&tr=http://tracker.anirena.com:80/announce&tr=http://anidex.moe:6969/announce&tr=udp://tracker.opentrackr.org:1337&tr=udp://tracker.coppersurfer.tk:6969&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://zer0day.ch:1337&tr=udp://9.rarbg.com:2710/announce&tr=udp://tracker2.christianbro.pw:6969/announce&tr=udp://tracker.coppersurfer.tk:6969&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://eddie4.nl:6969/announce&tr=udp://tracker.doko.moe:6969/announce\",\n\t\"torrent\": \"https://nyaa.pantsu.cat/download/6E4D96F7A0B0456672E80B150CCB7C15868CD47D\",\n\t\"seeders\": 4,\n\t\"leechers\": 2,\n\t\"completed\": 28,\n\t\"last_scrape\": \"2017-07-07T07:48:32.509635Z\",\n\t\"file_list\": [\n\t{\n\t\"path\": \"[HorribleSubs] Uchouten Kazoku S2 - 01[720p].mkv\",\n\t\"filesize\": 338250895\n\t},\n\t{\n\t\"path\": \"[HorribleSubs] Uchouten Kazoku S2 - 12 [720p].mkv\",\n\t\"filesize\": 338556275\n\t}\n\t]\n\t}",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Torrents", "groupTitle": "Torrents",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "String[]", "type": "String[]",
"optional": false, "optional": false,
"field": "errors", "field": "errors",
"description": "<p>List of errors messages with a 404 error message in it.</p>" "description": "<p>List of errors messages with a 404 error message in it.</p>"
} }]
]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -575,47 +548,39 @@ define({ "api": [
"group": "Torrents", "group": "Torrents",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "Number", "type": "Number",
"optional": false, "optional": false,
"field": "id", "field": "id",
"description": "<p>Torrent unique ID.</p>" "description": "<p>Torrent unique ID.</p>"
} }]
]
} }
}, },
"success": { "success": {
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": "HTTP/1.1 200 OK", "content": "HTTP/1.1 200 OK",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Torrents", "groupTitle": "Torrents",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "String[]", "type": "String[]",
"optional": false, "optional": false,
"field": "errors", "field": "errors",
"description": "<p>List of errors messages with a 404 error message in it.</p>" "description": "<p>List of errors messages with a 404 error message in it.</p>"
} }]
]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -627,21 +592,18 @@ define({ "api": [
"group": "Torrents", "group": "Torrents",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "Number", "type": "Number",
"optional": false, "optional": false,
"field": "id", "field": "id",
"description": "<p>Torrent unique ID.</p>" "description": "<p>Torrent unique ID.</p>"
} }]
]
} }
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Object[]", "type": "Object[]",
"optional": false, "optional": false,
@ -664,35 +626,29 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": " HTTP/1.1 200 OK\n {\n\t\t\t\"torrents\": [...],\n\t\t\t\"queryRecordCount\": 50,\n\t\t\t\"totalRecordCount\": 798414\n\t\t}", "content": " HTTP/1.1 200 OK\n {\n\t\t\t\"torrents\": [...],\n\t\t\t\"queryRecordCount\": 50,\n\t\t\t\"totalRecordCount\": 798414\n\t\t}",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Torrents", "groupTitle": "Torrents",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "String[]", "type": "String[]",
"optional": false, "optional": false,
"field": "errors", "field": "errors",
"description": "<p>List of errors messages with a 404 error message in it.</p>" "description": "<p>List of errors messages with a 404 error message in it.</p>"
} }]
]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -704,8 +660,7 @@ define({ "api": [
"group": "Torrents", "group": "Torrents",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "String", "type": "String",
"optional": false, "optional": false,
@ -780,8 +735,7 @@ define({ "api": [
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -804,20 +758,17 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": "HTTP/1.1 200 OK", "content": "HTTP/1.1 200 OK",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Torrents", "groupTitle": "Torrents",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -840,13 +791,11 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -858,8 +807,7 @@ define({ "api": [
"group": "Torrents", "group": "Torrents",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "String", "type": "String",
"optional": false, "optional": false,
@ -941,8 +889,7 @@ define({ "api": [
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -965,20 +912,17 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": "HTTP/1.1 200 OK", "content": "HTTP/1.1 200 OK",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Torrents", "groupTitle": "Torrents",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -1001,13 +945,11 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -1019,8 +961,7 @@ define({ "api": [
"group": "Users", "group": "Users",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "String", "type": "String",
"optional": false, "optional": false,
@ -1039,8 +980,7 @@ define({ "api": [
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -1063,20 +1003,17 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\ttoken:\"token\",\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}", "content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\ttoken:\"token\",\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Users", "groupTitle": "Users",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -1099,13 +1036,11 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }",
"type": "json" "type": "json"
} }]
]
} }
}, },
{ {
@ -1117,21 +1052,18 @@ define({ "api": [
"group": "Users", "group": "Users",
"parameter": { "parameter": {
"fields": { "fields": {
"Parameter": [ "Parameter": [{
{
"group": "Parameter", "group": "Parameter",
"type": "Number", "type": "Number",
"optional": false, "optional": false,
"field": "id", "field": "id",
"description": "<p>User ID.</p>" "description": "<p>User ID.</p>"
} }]
]
} }
}, },
"success": { "success": {
"fields": { "fields": {
"Success 200": [ "Success 200": [{
{
"group": "Success 200", "group": "Success 200",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -1154,20 +1086,17 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Success-Response:", "title": "Success-Response:",
"content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}", "content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}",
"type": "json" "type": "json"
} }]
]
}, },
"filename": "controllers/api/api.go", "filename": "controllers/api/api.go",
"groupTitle": "Users", "groupTitle": "Users",
"error": { "error": {
"fields": { "fields": {
"Error 4xx": [ "Error 4xx": [{
{
"group": "Error 4xx", "group": "Error 4xx",
"type": "Boolean", "type": "Boolean",
"optional": false, "optional": false,
@ -1190,13 +1119,12 @@ define({ "api": [
} }
] ]
}, },
"examples": [ "examples": [{
{
"title": "Error-Response:", "title": "Error-Response:",
"content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }",
"type": "json" "type": "json"
}]
}
} }
] ]
} });
}
] });

Voir le fichier

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Loading...</title> <title>Loading...</title>
@ -11,6 +12,7 @@
<link href="img/favicon.ico" rel="icon" type="image/x-icon"> <link href="img/favicon.ico" rel="icon" type="image/x-icon">
<script src="vendor/polyfill.js"></script> <script src="vendor/polyfill.js"></script>
</head> </head>
<body> <body>
<script id="template-sidenav" type="text/x-handlebars-template"> <script id="template-sidenav" type="text/x-handlebars-template">
@ -20,29 +22,23 @@
<span class="search-reset">x</span> <span class="search-reset">x</span>
</div> </div>
<ul class="sidenav nav nav-list list"> <ul class="sidenav nav nav-list list">
{{#each nav}} {{#each nav}} {{#if title}} {{#if isHeader}} {{#if isFixed}}
{{#if title}}
{{#if isHeader}}
{{#if isFixed}}
<li class="nav-fixed nav-header navbar-btn nav-list-item" data-group="{{group}}"><a href="#api-{{group}}">{{underscoreToSpace title}}</a></li> <li class="nav-fixed nav-header navbar-btn nav-list-item" data-group="{{group}}"><a href="#api-{{group}}">{{underscoreToSpace title}}</a></li>
{{else}} {{else}}
<li class="nav-header nav-list-item" data-group="{{group}}"><a href="#api-{{group}}">{{underscoreToSpace title}}</a></li> <li class="nav-header nav-list-item" data-group="{{group}}"><a href="#api-{{group}}">{{underscoreToSpace title}}</a></li>
{{/if}} {{/if}} {{else}}
{{else}}
<li class="{{#if hidden}}hide {{/if}}" data-group="{{group}}" data-name="{{name}}" data-version="{{version}}"> <li class="{{#if hidden}}hide {{/if}}" data-group="{{group}}" data-name="{{name}}" data-version="{{version}}">
<a href="#api-{{group}}-{{name}}" class="nav-list-item">{{title}}</a> <a href="#api-{{group}}-{{name}}" class="nav-list-item">{{title}}</a>
</li> </li>
{{/if}} {{/if}} {{/if}} {{/each}}
{{/if}}
{{/each}}
</ul> </ul>
</nav> </nav>
</script> </script>
<script id="template-project" type="text/x-handlebars-template"> <script id="template-project" type="text/x-handlebars-template">
<div class="pull-left"> <div class="pull-left">
<h1>{{name}}</h1> <h1>{{name}}</h1> {{#if description}}
{{#if description}}<h2>{{{nl2br description}}}</h2>{{/if}} <h2>{{{nl2br description}}}</h2>{{/if}}
</div> </div>
{{#if template.withCompare}} {{#if template.withCompare}}
<div class="pull-right"> <div class="pull-right">
@ -77,22 +73,18 @@
</script> </script>
<script id="template-generator" type="text/x-handlebars-template"> <script id="template-generator" type="text/x-handlebars-template">
{{#if template.withGenerator}} {{#if template.withGenerator}} {{#if generator}}
{{#if generator}}
<div class="content"> <div class="content">
{{__ "Generated with"}} <a href="{{{generator.url}}}">{{{generator.name}}}</a> {{{generator.version}}} - {{{generator.time}}} {{__ "Generated with"}} <a href="{{{generator.url}}}">{{{generator.name}}}</a> {{{generator.version}}} - {{{generator.time}}}
</div> </div>
{{/if}} {{/if}} {{/if}}
{{/if}}
</script> </script>
<script id="template-sections" type="text/x-handlebars-template"> <script id="template-sections" type="text/x-handlebars-template">
<section id="api-{{group}}"> <section id="api-{{group}}">
<h1>{{underscoreToSpace title}}</h1> <h1>{{underscoreToSpace title}}</h1> {{#if description}}
{{#if description}}
<p>{{{nl2br description}}}</p> <p>{{{nl2br description}}}</p>
{{/if}} {{/if}} {{#each articles}}
{{#each articles}}
<div id="api-{{group}}-{{name}}"> <div id="api-{{group}}-{{name}}">
{{{article}}} {{{article}}}
</div> </div>
@ -123,32 +115,20 @@
<div class="clearfix"></div> <div class="clearfix"></div>
{{#if article.deprecated}} {{#if article.deprecated}}
<p class="deprecated"><span>{{__ "DEPRECATED"}}</span> <p class="deprecated"><span>{{__ "DEPRECATED"}}</span> {{{markdown article.deprecated.content}}}
{{{markdown article.deprecated.content}}}
</p> </p>
{{/if}} {{/if}} {{#if article.description}}
{{#if article.description}}
<p>{{{nl2br article.description}}}</p> <p>{{{nl2br article.description}}}</p>
{{/if}} {{/if}}
<span class="type type__{{toLowerCase article.type}}">{{toLowerCase article.type}}</span> <span class="type type__{{toLowerCase article.type}}">{{toLowerCase article.type}}</span>
<pre class="prettyprint language-html" data-type="{{toLowerCase article.type}}"><code>{{article.url}}</code></pre> <pre class="prettyprint language-html" data-type="{{toLowerCase article.type}}"><code>{{article.url}}</code></pre> {{#if article.permission}}
{{#if article.permission}}
<p> <p>
{{__ "Permission:"}} {{__ "Permission:"}} {{#each article.permission}} {{name}} {{#if title}}
{{#each article.permission}}
{{name}}
{{#if title}}
<button type="button" class="btn btn-info btn-xs" data-title="{{title}}" data-content="{{nl2br description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover"> <button type="button" class="btn btn-info btn-xs" data-title="{{title}}" data-content="{{nl2br description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button> </button> {{/if}} {{/each}}
{{/if}}
{{/each}}
</p> </p>
{{/if}} {{/if}} {{#if_gt article.examples.length compare=0}}
{{#if_gt article.examples.length compare=0}}
<ul class="nav nav-tabs nav-tabs-examples"> <ul class="nav nav-tabs nav-tabs-examples">
{{#each article.examples}} {{#each article.examples}}
<li{{#if_eq @index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq @index compare=0}} class="active" {{/if_eq}}>
@ -164,26 +144,21 @@
</div> </div>
{{/each}} {{/each}}
</div> </div>
{{/if_gt}} {{/if_gt}} {{subTemplate "article-param-block" params=article.header _hasType=_hasTypeInHeaderFields section="header"}} {{subTemplate "article-param-block" params=article.parameter _hasType=_hasTypeInParameterFields section="parameter"}} {{subTemplate
"article-param-block" params=article.success _hasType=_hasTypeInSuccessFields section="success"}} {{subTemplate "article-param-block" params=article.error _col1="Name" _hasType=_hasTypeInErrorFields section="error"}} {{subTemplate "article-sample-request"
{{subTemplate "article-param-block" params=article.header _hasType=_hasTypeInHeaderFields section="header"}} article=article id=id}}
{{subTemplate "article-param-block" params=article.parameter _hasType=_hasTypeInParameterFields section="parameter"}}
{{subTemplate "article-param-block" params=article.success _hasType=_hasTypeInSuccessFields section="success"}}
{{subTemplate "article-param-block" params=article.error _col1="Name" _hasType=_hasTypeInErrorFields section="error"}}
{{subTemplate "article-sample-request" article=article id=id}}
</article> </article>
</script> </script>
<script id="template-article-param-block" type="text/x-handlebars-template"> <script id="template-article-param-block" type="text/x-handlebars-template">
{{#if params}} {{#if params}} {{#each params.fields}}
{{#each params.fields}}
<h2>{{__ @key}}</h2> <h2>{{__ @key}}</h2>
<table> <table>
<thead> <thead>
<tr> <tr>
<th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th> <th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th>
{{#if ../_hasType}}<th style="width: 10%">{{__ "Type"}}</th>{{/if}} {{#if ../_hasType}}
<th style="width: 10%">{{__ "Type"}}</th>{{/if}}
<th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th> <th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th>
</tr> </tr>
</thead> </thead>
@ -197,13 +172,11 @@
</td> </td>
{{/if}} {{/if}}
<td> <td>
{{{nl2br description}}} {{{nl2br description}}} {{#if defaultValue}}
{{#if defaultValue}}<p class="default-value">{{__ "Default value:"}} <code>{{{defaultValue}}}</code></p>{{/if}} <p class="default-value">{{__ "Default value:"}} <code>{{{defaultValue}}}</code></p>{{/if}} {{#if size}}
{{#if size}}<p class="type-size">{{__ "Size range:"}} <code>{{{size}}}</code></p>{{/if}} <p class="type-size">{{__ "Size range:"}} <code>{{{size}}}</code></p>{{/if}} {{#if allowedValues}}
{{#if allowedValues}}<p class="type-size">{{__ "Allowed values:"}} <p class="type-size">{{__ "Allowed values:"}} {{#each allowedValues}}
{{#each allowedValues}} <code>{{{this}}}</code>{{#unless @last}}, {{/unless}} {{/each}}
<code>{{{this}}}</code>{{#unless @last}}, {{/unless}}
{{/each}}
</p> </p>
{{/if}} {{/if}}
</td> </td>
@ -211,8 +184,7 @@
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
{{/each}} {{/each}} {{#if_gt params.examples.length compare=0}}
{{#if_gt params.examples.length compare=0}}
<ul class="nav nav-tabs nav-tabs-examples"> <ul class="nav nav-tabs nav-tabs-examples">
{{#each params.examples}} {{#each params.examples}}
<li{{#if_eq @index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq @index compare=0}} class="active" {{/if_eq}}>
@ -228,8 +200,7 @@
</div> </div>
{{/each}} {{/each}}
</div> </div>
{{/if_gt}} {{/if_gt}} {{/if}}
{{/if}}
</script> </script>
<script id="template-article-sample-request" type="text/x-handlebars-template"> <script id="template-article-sample-request" type="text/x-handlebars-template">
@ -245,10 +216,8 @@
</div> </div>
</div> </div>
{{#if article.header}} {{#if article.header}} {{#if article.header.fields}}
{{#if article.header.fields}} <h3>{{__ "Headers"}}</h3> {{#each article.header.fields}}
<h3>{{__ "Headers"}}</h3>
{{#each article.header.fields}}
<h4><input type="radio" data-sample-request-header-group-id="sample-request-header-{{@index}}" name="{{../id}}-sample-request-header" value="{{@index}}" class="sample-request-header sample-request-switch" {{#if_eq @index compare=0}} checked{{/if_eq}} />{{@key}}</h4> <h4><input type="radio" data-sample-request-header-group-id="sample-request-header-{{@index}}" name="{{../id}}-sample-request-header" value="{{@index}}" class="sample-request-header sample-request-switch" {{#if_eq @index compare=0}} checked{{/if_eq}} />{{@key}}</h4>
<div class="{{../id}}-sample-request-header-fields{{#if_gt @index compare=0}} hide{{/if_gt}}"> <div class="{{../id}}-sample-request-header-fields{{#if_gt @index compare=0}} hide{{/if_gt}}">
{{#each this}} {{#each this}}
@ -261,27 +230,20 @@
</div> </div>
{{/each}} {{/each}}
</div> </div>
{{/each}} {{/each}} {{/if}} {{/if}} {{#if article.parameter}} {{#if article.parameter.fields}}
{{/if}} <h3>{{__ "Parameters"}}</h3> {{#each article.parameter.fields}}
{{/if}}
{{#if article.parameter}}
{{#if article.parameter.fields}}
<h3>{{__ "Parameters"}}</h3>
{{#each article.parameter.fields}}
<h4><input type="radio" data-sample-request-param-group-id="sample-request-param-{{@index}}" name="{{../id}}-sample-request-param" value="{{@index}}" class="sample-request-param sample-request-switch" {{#if_eq @index compare=0}} checked{{/if_eq}} />{{@key}}</h4> <h4><input type="radio" data-sample-request-param-group-id="sample-request-param-{{@index}}" name="{{../id}}-sample-request-param" value="{{@index}}" class="sample-request-param sample-request-switch" {{#if_eq @index compare=0}} checked{{/if_eq}} />{{@key}}</h4>
<div class="form-group {{../id}}-sample-request-param-fields{{#if_gt @index compare=0}} hide{{/if_gt}}"> <div class="form-group {{../id}}-sample-request-param-fields{{#if_gt @index compare=0}} hide{{/if_gt}}">
{{#each this}} {{#each this}}
<label class="col-md-3 control-label" for="sample-request-param-field-{{field}}">{{field}}</label> <label class="col-md-3 control-label" for="sample-request-param-field-{{field}}">{{field}}</label>
<div class="input-group"> <div class="input-group">
<input id="sample-request-param-field-{{field}}" type="text" placeholder="{{field}}" class="form-control sample-request-param" data-sample-request-param-name="{{field}}" data-sample-request-param-group="sample-request-param-{{@../index}}" {{#if optional}}data-sample-request-param-optional="true"{{/if}}> <input id="sample-request-param-field-{{field}}" type="text" placeholder="{{field}}" class="form-control sample-request-param" data-sample-request-param-name="{{field}}" data-sample-request-param-group="sample-request-param-{{@../index}}" {{#if optional}}data-sample-request-param-optional="true"
{{/if}}>
<div class="input-group-addon">{{{type}}}</div> <div class="input-group-addon">{{{type}}}</div>
</div> </div>
{{/each}} {{/each}}
</div> </div>
{{/each}} {{/each}} {{/if}} {{/if}}
{{/if}}
{{/if}}
<div class="form-group"> <div class="form-group">
<div class="controls pull-right"> <div class="controls pull-right">
@ -327,312 +289,209 @@
{{#if article.description}} {{#if article.description}}
<p>{{{showDiff article.description compare.description "nl2br"}}}</p> <p>{{{showDiff article.description compare.description "nl2br"}}}</p>
{{else}} {{else}} {{#if compare.description}}
{{#if compare.description}}
<p>{{{showDiff "" compare.description "nl2br"}}}</p> <p>{{{showDiff "" compare.description "nl2br"}}}</p>
{{/if}} {{/if}} {{/if}}
{{/if}}
<pre class="prettyprint language-html" data-type="{{toLowerCase article.type}}"><code>{{{showDiff article.url compare.url}}}</code></pre> <pre class="prettyprint language-html" data-type="{{toLowerCase article.type}}"><code>{{{showDiff article.url compare.url}}}</code></pre> {{subTemplate "article-compare-permission" article=article compare=compare}}
{{subTemplate "article-compare-permission" article=article compare=compare}}
<ul class="nav nav-tabs nav-tabs-examples"> <ul class="nav nav-tabs nav-tabs-examples">
{{#each_compare_title article.examples compare.examples}} {{#each_compare_title article.examples compare.examples}} {{#if typeSame}}
{{#if typeSame}}
<li{{#if_eq index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq index compare=0}} class="active" {{/if_eq}}>
<a href="#compare-examples-{{../../article.id}}-{{index}}">{{{showDiff source.title compare.title}}}</a> <a href="#compare-examples-{{../../article.id}}-{{index}}">{{{showDiff source.title compare.title}}}</a>
</li> </li>
{{/if}} {{/if}} {{#if typeIns}}
{{#if typeIns}}
<li{{#if_eq index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq index compare=0}} class="active" {{/if_eq}}>
<a href="#compare-examples-{{../../article.id}}-{{index}}"><ins>{{{source.title}}}</ins></a> <a href="#compare-examples-{{../../article.id}}-{{index}}"><ins>{{{source.title}}}</ins></a>
</li> </li>
{{/if}} {{/if}} {{#if typeDel}}
{{#if typeDel}}
<li{{#if_eq index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq index compare=0}} class="active" {{/if_eq}}>
<a href="#compare-examples-{{../../article.id}}-{{index}}"><del>{{{compare.title}}}</del></a> <a href="#compare-examples-{{../../article.id}}-{{index}}"><del>{{{compare.title}}}</del></a>
</li> </li>
{{/if}} {{/if}} {{/each_compare_title}}
{{/each_compare_title}}
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
{{#each_compare_title article.examples compare.examples}} {{#each_compare_title article.examples compare.examples}} {{#if typeSame}}
{{#if typeSame}}
<div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="compare-examples-{{../../article.id}}-{{index}}"> <div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="compare-examples-{{../../article.id}}-{{index}}">
<pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{showDiff source.content compare.content}}}</code></pre> <pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{showDiff source.content compare.content}}}</code></pre>
</div> </div>
{{/if}} {{/if}} {{#if typeIns}}
{{#if typeIns}}
<div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="compare-examples-{{../../article.id}}-{{index}}"> <div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="compare-examples-{{../../article.id}}-{{index}}">
<pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{source.content}}}</code></pre> <pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{source.content}}}</code></pre>
</div> </div>
{{/if}} {{/if}} {{#if typeDel}}
{{#if typeDel}}
<div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="compare-examples-{{../../article.id}}-{{index}}"> <div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="compare-examples-{{../../article.id}}-{{index}}">
<pre class="prettyprint language-{{source.type}}" data-type="{{compare.type}}"><code>{{{compare.content}}}</code></pre> <pre class="prettyprint language-{{source.type}}" data-type="{{compare.type}}"><code>{{{compare.content}}}</code></pre>
</div> </div>
{{/if}} {{/if}} {{/each_compare_title}}
{{/each_compare_title}}
</div> </div>
{{subTemplate "article-compare-param-block" source=article.parameter compare=compare.parameter _hasType=_hasTypeInParameterFields section="parameter"}} {{subTemplate "article-compare-param-block" source=article.parameter compare=compare.parameter _hasType=_hasTypeInParameterFields section="parameter"}} {{subTemplate "article-compare-param-block" source=article.success compare=compare.success _hasType=_hasTypeInSuccessFields
{{subTemplate "article-compare-param-block" source=article.success compare=compare.success _hasType=_hasTypeInSuccessFields section="success"}} section="success"}} {{subTemplate "article-compare-param-block" source=article.error compare=compare.error _col1="Name" _hasType=_hasTypeInErrorFields section="error"}} {{subTemplate "article-sample-request" article=article id=id}}
{{subTemplate "article-compare-param-block" source=article.error compare=compare.error _col1="Name" _hasType=_hasTypeInErrorFields section="error"}}
{{subTemplate "article-sample-request" article=article id=id}}
</article> </article>
</script> </script>
<script id="template-article-compare-permission" type="text/x-handlebars-template"> <script id="template-article-compare-permission" type="text/x-handlebars-template">
<p> <p>
{{__ "Permission:"}} {{__ "Permission:"}} {{#each_compare_list_field article.permission compare.permission field="name"}} {{#if source}} {{#if typeSame}} {{source.name}} {{#if source.title}}
{{#each_compare_list_field article.permission compare.permission field="name"}}
{{#if source}}
{{#if typeSame}}
{{source.name}}
{{#if source.title}}
<button type="button" class="btn btn-info btn-xs" data-title="{{source.title}}" data-content="{{nl2br source.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover"> <button type="button" class="btn btn-info btn-xs" data-title="{{source.title}}" data-content="{{nl2br source.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button> </button> {{#unless _last}}, {{/unless}} {{/if}} {{/if}} {{#if typeIns}}
{{#unless _last}}, {{/unless}} <ins>{{source.name}}</ins> {{#if source.title}}
{{/if}}
{{/if}}
{{#if typeIns}}
<ins>{{source.name}}</ins>
{{#if source.title}}
<button type="button" class="btn btn-info btn-xs" data-title="{{source.title}}" data-content="{{nl2br source.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover"> <button type="button" class="btn btn-info btn-xs" data-title="{{source.title}}" data-content="{{nl2br source.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button> </button> {{#unless _last}}, {{/unless}} {{/if}} {{/if}} {{#if typeDel}}
{{#unless _last}}, {{/unless}} <del>{{source.name}}</del> {{#if source.title}}
{{/if}}
{{/if}}
{{#if typeDel}}
<del>{{source.name}}</del>
{{#if source.title}}
<button type="button" class="btn btn-info btn-xs" data-title="{{source.title}}" data-content="{{nl2br source.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover"> <button type="button" class="btn btn-info btn-xs" data-title="{{source.title}}" data-content="{{nl2br source.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button> </button> {{#unless _last}}, {{/unless}} {{/if}} {{/if}} {{else}} {{#if typeSame}} {{compare.name}} {{#if compare.title}}
{{#unless _last}}, {{/unless}}
{{/if}}
{{/if}}
{{else}}
{{#if typeSame}}
{{compare.name}}
{{#if compare.title}}
<button type="button" class="btn btn-info btn-xs" data-title="{{compare.title}}" data-content="{{nl2br compare.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover"> <button type="button" class="btn btn-info btn-xs" data-title="{{compare.title}}" data-content="{{nl2br compare.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button> </button> {{#unless _last}}, {{/unless}} {{/if}} {{/if}} {{#if typeIns}}
{{#unless _last}}, {{/unless}} <ins>{{compare.name}}</ins> {{#if compare.title}}
{{/if}}
{{/if}}
{{#if typeIns}}
<ins>{{compare.name}}</ins>
{{#if compare.title}}
<button type="button" class="btn btn-info btn-xs" data-title="{{compare.title}}" data-content="{{nl2br compare.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover"> <button type="button" class="btn btn-info btn-xs" data-title="{{compare.title}}" data-content="{{nl2br compare.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button> </button> {{#unless _last}}, {{/unless}} {{/if}} {{/if}} {{#if typeDel}}
{{#unless _last}}, {{/unless}} <del>{{compare.name}}</del> {{#if compare.title}}
{{/if}}
{{/if}}
{{#if typeDel}}
<del>{{compare.name}}</del>
{{#if compare.title}}
<button type="button" class="btn btn-info btn-xs" data-title="{{compare.title}}" data-content="{{nl2br compare.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover"> <button type="button" class="btn btn-info btn-xs" data-title="{{compare.title}}" data-content="{{nl2br compare.description}}" data-html="true" data-toggle="popover" data-placement="right" data-trigger="hover">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button> </button> {{#unless _last}}, {{/unless}} {{/if}} {{/if}} {{/if}} {{/each_compare_list_field}}
{{#unless _last}}, {{/unless}}
{{/if}}
{{/if}}
{{/if}}
{{/each_compare_list_field}}
</p> </p>
</script> </script>
<script id="template-article-compare-param-block" type="text/x-handlebars-template"> <script id="template-article-compare-param-block" type="text/x-handlebars-template">
{{#if source}} {{#if source}} {{#each_compare_keys source.fields compare.fields}} {{#if typeSame}}
{{#each_compare_keys source.fields compare.fields}}
{{#if typeSame}}
<h2>{{__ source.key}}</h2> <h2>{{__ source.key}}</h2>
<table> <table>
<thead> <thead>
<tr> <tr>
<th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th> <th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th>
{{#if ../_hasType}}<th style="width: 10%">{{__ "Type"}}</th>{{/if}} {{#if ../_hasType}}
<th style="width: 10%">{{__ "Type"}}</th>{{/if}}
<th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th> <th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th>
</tr> </tr>
</thead> </thead>
{{subTemplate "article-compare-param-block-body" source=source.value compare=compare.value _hasType=../_hasType}} {{subTemplate "article-compare-param-block-body" source=source.value compare=compare.value _hasType=../_hasType}}
</table> </table>
{{/if}} {{/if}} {{#if typeIns}}
{{#if typeIns}}
<h2><ins>{{__ source.key}}</ins></h2> <h2><ins>{{__ source.key}}</ins></h2>
<table class="ins"> <table class="ins">
<thead> <thead>
<tr> <tr>
<th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th> <th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th>
{{#if ../_hasType}}<th style="width: 10%">{{__ "Type"}}</th>{{/if}} {{#if ../_hasType}}
<th style="width: 10%">{{__ "Type"}}</th>{{/if}}
<th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th> <th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th>
</tr> </tr>
</thead> </thead>
{{subTemplate "article-compare-param-block-body" source=source.value compare=source.value _hasType=../_hasType}} {{subTemplate "article-compare-param-block-body" source=source.value compare=source.value _hasType=../_hasType}}
</table> </table>
{{/if}} {{/if}} {{#if typeDel}}
{{#if typeDel}}
<h2><del>{{__ compare.key}}</del></h2> <h2><del>{{__ compare.key}}</del></h2>
<table class="del"> <table class="del">
<thead> <thead>
<tr> <tr>
<th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th> <th style="width: 30%">{{#if ../_col1}}{{__ ../_col1}}{{else}}{{__ "Field"}}{{/if}}</th>
{{#if ../_hasType}}<th style="width: 10%">{{__ "Type"}}</th>{{/if}} {{#if ../_hasType}}
<th style="width: 10%">{{__ "Type"}}</th>{{/if}}
<th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th> <th style="width: {{#if ../_hasType}}60%{{else}}70%{{/if}}">{{__ "Description"}}</th>
</tr> </tr>
</thead> </thead>
{{subTemplate "article-compare-param-block-body" source=compare.value compare=compare.value _hasType=../_hasType}} {{subTemplate "article-compare-param-block-body" source=compare.value compare=compare.value _hasType=../_hasType}}
</table> </table>
{{/if}} {{/if}} {{/each_compare_keys}} {{#if source.examples}}
{{/each_compare_keys}}
{{#if source.examples}}
<ul class="nav nav-tabs nav-tabs-examples"> <ul class="nav nav-tabs nav-tabs-examples">
{{#each_compare_title source.examples compare.examples}} {{#each_compare_title source.examples compare.examples}} {{#if typeSame}}
{{#if typeSame}}
<li{{#if_eq index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq index compare=0}} class="active" {{/if_eq}}>
<a href="#{{../../section}}-compare-examples-{{../../article.id}}-{{index}}">{{{showDiff source.title compare.title}}}</a> <a href="#{{../../section}}-compare-examples-{{../../article.id}}-{{index}}">{{{showDiff source.title compare.title}}}</a>
</li> </li>
{{/if}} {{/if}} {{#if typeIns}}
{{#if typeIns}}
<li{{#if_eq index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq index compare=0}} class="active" {{/if_eq}}>
<a href="#{{../../section}}-compare-examples-{{../../article.id}}-{{index}}"><ins>{{{source.title}}}</ins></a> <a href="#{{../../section}}-compare-examples-{{../../article.id}}-{{index}}"><ins>{{{source.title}}}</ins></a>
</li> </li>
{{/if}} {{/if}} {{#if typeDel}}
{{#if typeDel}}
<li{{#if_eq index compare=0}} class="active" {{/if_eq}}> <li{{#if_eq index compare=0}} class="active" {{/if_eq}}>
<a href="#{{../../section}}-compare-examples-{{../../article.id}}-{{index}}"><del>{{{compare.title}}}</del></a> <a href="#{{../../section}}-compare-examples-{{../../article.id}}-{{index}}"><del>{{{compare.title}}}</del></a>
</li> </li>
{{/if}} {{/if}} {{/each_compare_title}}
{{/each_compare_title}}
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
{{#each_compare_title source.examples compare.examples}} {{#each_compare_title source.examples compare.examples}} {{#if typeSame}}
{{#if typeSame}}
<div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="{{../../section}}-compare-examples-{{../../article.id}}-{{index}}"> <div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="{{../../section}}-compare-examples-{{../../article.id}}-{{index}}">
<pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{showDiff source.content compare.content}}}</code></pre> <pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{showDiff source.content compare.content}}}</code></pre>
</div> </div>
{{/if}} {{/if}} {{#if typeIns}}
{{#if typeIns}}
<div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="{{../../section}}-compare-examples-{{../../article.id}}-{{index}}"> <div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="{{../../section}}-compare-examples-{{../../article.id}}-{{index}}">
<pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{source.content}}}</code></pre> <pre class="prettyprint language-{{source.type}}" data-type="{{source.type}}"><code>{{{source.content}}}</code></pre>
</div> </div>
{{/if}} {{/if}} {{#if typeDel}}
{{#if typeDel}}
<div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="{{../../section}}-compare-examples-{{../../article.id}}-{{index}}"> <div class="tab-pane{{#if_eq index compare=0}} active{{/if_eq}}" id="{{../../section}}-compare-examples-{{../../article.id}}-{{index}}">
<pre class="prettyprint language-{{source.type}}" data-type="{{compare.type}}"><code>{{{compare.content}}}</code></pre> <pre class="prettyprint language-{{source.type}}" data-type="{{compare.type}}"><code>{{{compare.content}}}</code></pre>
</div> </div>
{{/if}} {{/if}} {{/each_compare_title}}
{{/each_compare_title}}
</div> </div>
{{/if}} {{/if}} {{/if}}
{{/if}}
</script> </script>
<script id="template-article-compare-param-block-body" type="text/x-handlebars-template"> <script id="template-article-compare-param-block-body" type="text/x-handlebars-template">
<tbody> <tbody>
{{#each_compare_field source compare}} {{#each_compare_field source compare}} {{#if typeSame}}
{{#if typeSame}}
<tr> <tr>
<td class="code"> <td class="code">
{{{splitFill source.field "." "&nbsp;&nbsp;"}}} {{{splitFill source.field "." "&nbsp;&nbsp;"}}} {{#if source.optional}} {{#if compare.optional}} <span class="label label-optional">{{__ "optional"}}</span> {{else}} <span class="label label-optional label-ins">{{__ "optional"}}</span> {{/if}}
{{#if source.optional}} {{else}} {{#if compare.optional}} <span class="label label-optional label-del">{{__ "optional"}}</span>{{/if}} {{/if}}
{{#if compare.optional}} <span class="label label-optional">{{__ "optional"}}</span>
{{else}} <span class="label label-optional label-ins">{{__ "optional"}}</span>
{{/if}}
{{else}}
{{#if compare.optional}} <span class="label label-optional label-del">{{__ "optional"}}</span>{{/if}}
{{/if}}
</td> </td>
{{#if source.type}} {{#if source.type}} {{#if compare.type}}
{{#if compare.type}}
<td>{{{showDiff source.type compare.type}}}</td> <td>{{{showDiff source.type compare.type}}}</td>
{{else}} {{else}}
<td>{{{source.type}}}</td> <td>{{{source.type}}}</td>
{{/if}} {{/if}} {{else}} {{#if compare.type}}
{{else}}
{{#if compare.type}}
<td>{{{compare.type}}}</td> <td>{{{compare.type}}}</td>
{{else}} {{else}} {{#if ../../../../_hasType}}
{{#if ../../../../_hasType}}<td></td>{{/if}} <td></td>{{/if}} {{/if}} {{/if}}
{{/if}}
{{/if}}
<td> <td>
{{{showDiff source.description compare.description "nl2br"}}} {{{showDiff source.description compare.description "nl2br"}}} {{#if source.defaultValue}}
{{#if source.defaultValue}}<p class="default-value">{{__ "Default value:"}} <code>{{{showDiff source.defaultValue compare.defaultValue}}}</code><p>{{/if}} <p class="default-value">{{__ "Default value:"}} <code>{{{showDiff source.defaultValue compare.defaultValue}}}</code>
<p>{{/if}}
</td> </td>
</tr> </tr>
{{/if}} {{/if}} {{#if typeIns}}
{{#if typeIns}}
<tr class="ins"> <tr class="ins">
<td class="code"> <td class="code">
{{{splitFill source.field "." "&nbsp;&nbsp;"}}} {{{splitFill source.field "." "&nbsp;&nbsp;"}}} {{#if source.optional}} <span class="label label-optional label-ins">{{__ "optional"}}</span>{{/if}}
{{#if source.optional}} <span class="label label-optional label-ins">{{__ "optional"}}</span>{{/if}}
</td> </td>
{{#if source.type}} {{#if source.type}}
<td>{{{source.type}}}</td> <td>{{{source.type}}}</td>
{{else}} {{else}} {{{typRowTd}}} {{/if}}
{{{typRowTd}}}
{{/if}}
<td> <td>
{{{nl2br source.description}}} {{{nl2br source.description}}} {{#if source.defaultValue}}
{{#if source.defaultValue}}<p class="default-value">{{__ "Default value:"}} <code>{{{source.defaultValue}}}</code><p>{{/if}} <p class="default-value">{{__ "Default value:"}} <code>{{{source.defaultValue}}}</code>
<p>{{/if}}
</td> </td>
</tr> </tr>
{{/if}} {{/if}} {{#if typeDel}}
{{#if typeDel}}
<tr class="del"> <tr class="del">
<td class="code"> <td class="code">
{{{splitFill compare.field "." "&nbsp;&nbsp;"}}} {{{splitFill compare.field "." "&nbsp;&nbsp;"}}} {{#if compare.optional}} <span class="label label-optional label-del">{{__ "optional"}}</span>{{/if}}
{{#if compare.optional}} <span class="label label-optional label-del">{{__ "optional"}}</span>{{/if}}
</td> </td>
{{#if compare.type}} {{#if compare.type}}
<td>{{{compare.type}}}</td> <td>{{{compare.type}}}</td>
{{else}} {{else}} {{{typRowTd}}} {{/if}}
{{{typRowTd}}}
{{/if}}
<td> <td>
{{{nl2br compare.description}}} {{{nl2br compare.description}}} {{#if compare.defaultValue}}
{{#if compare.defaultValue}}<p class="default-value">{{__ "Default value:"}} <code>{{{compare.defaultValue}}}</code><p>{{/if}} <p class="default-value">{{__ "Default value:"}} <code>{{{compare.defaultValue}}}</code>
<p>{{/if}}
</td> </td>
</tr> </tr>
{{/if}} {{/if}} {{/each_compare_field}}
{{/each_compare_field}}
</tbody> </tbody>
</script> </script>
@ -652,13 +511,22 @@
<div id="loader"> <div id="loader">
<div class="spinner"> <div class="spinner">
<div class="spinner-container container1"> <div class="spinner-container container1">
<div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div> <div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div> </div>
<div class="spinner-container container2"> <div class="spinner-container container2">
<div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div> <div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div> </div>
<div class="spinner-container container3"> <div class="spinner-container container3">
<div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div> <div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div> </div>
<p>Loading...</p> <p>Loading...</p>
</div> </div>
@ -666,4 +534,5 @@
<script data-main="main.js" src="vendor/require.min.js"></script> <script data-main="main.js" src="vendor/require.min.js"></script>
</body> </body>
</html> </html>

Voir le fichier

@ -107,14 +107,21 @@ require([
// sort api within a group by title ASC and custom order // sort api within a group by title ASC and custom order
// //
var newList = []; var newList = [];
var umlauts = { 'ä': 'ae', 'ü': 'ue', 'ö': 'oe', 'ß': 'ss' }; // TODO: remove in version 1.0 var umlauts = {
'ä': 'ae',
'ü': 'ue',
'ö': 'oe',
'ß': 'ss'
}; // TODO: remove in version 1.0
$.each(apiByGroupAndName, function (index, groupEntries) { $.each(apiByGroupAndName, function (index, groupEntries) {
// get titles from the first entry of group[].name[] (name has versioning) // get titles from the first entry of group[].name[] (name has versioning)
var titles = []; var titles = [];
$.each(groupEntries, function (titleName, entries) { $.each(groupEntries, function (titleName, entries) {
var title = entries[0].title; var title = entries[0].title;
if (title !== undefined) { if (title !== undefined) {
title.toLowerCase().replace(/[äöüß]/g, function($0) { return umlauts[$0]; }); title.toLowerCase().replace(/[äöüß]/g, function ($0) {
return umlauts[$0];
});
titles.push(title + '#~#' + titleName); // '#~#' keep reference to titleName after sorting titles.push(title + '#~#' + titleName); // '#~#' keep reference to titleName after sorting
} }
}); });
@ -293,7 +300,9 @@ require([
$('#generator').append(templateGenerator(apiProject)); $('#generator').append(templateGenerator(apiProject));
// render Project // render Project
_.extend(apiProject, { versions: apiVersions}); _.extend(apiProject, {
versions: apiVersions
});
$('#project').append(templateProject(apiProject)); $('#project').append(templateProject(apiProject));
// render apiDoc, header/footer documentation // render apiDoc, header/footer documentation
@ -375,14 +384,19 @@ require([
$('#sections').append(content); $('#sections').append(content);
// Bootstrap Scrollspy // Bootstrap Scrollspy
$(this).scrollspy({ target: '#scrollingNav', offset: 18 }); $(this).scrollspy({
target: '#scrollingNav',
offset: 18
});
// Content-Scroll on Navigation click. // Content-Scroll on Navigation click.
$('.sidenav').find('a').on('click', function (e) { $('.sidenav').find('a').on('click', function (e) {
e.preventDefault(); e.preventDefault();
var id = $(this).attr('href'); var id = $(this).attr('href');
if ($(id).length > 0) if ($(id).length > 0)
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400); $('html,body').animate({
scrollTop: parseInt($(id).offset().top)
}, 400);
window.location.hash = $(this).attr('href'); window.location.hash = $(this).attr('href');
}); });
@ -390,7 +404,9 @@ require([
if (window.location.hash) { if (window.location.hash) {
var id = window.location.hash; var id = window.location.hash;
if ($(id).length > 0) if ($(id).length > 0)
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 0); $('html,body').animate({
scrollTop: parseInt($(id).offset().top)
}, 0);
} }
/** /**
@ -403,7 +419,9 @@ require([
function _hasTypeInFields(fields) { function _hasTypeInFields(fields) {
var result = false; var result = false;
$.each(fields, function (name) { $.each(fields, function (name) {
result = result || _.some(fields[name], function(item) { return item.type; }); result = result || _.some(fields[name], function (item) {
return item.type;
});
}); });
return result; return result;
} }
@ -519,7 +537,9 @@ require([
if (window.location.hash) { if (window.location.hash) {
var id = window.location.hash; var id = window.location.hash;
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 0); $('html,body').animate({
scrollTop: parseInt($(id).offset().top) - 18
}, 0);
} }
} }
@ -549,8 +569,7 @@ require([
$('span.search-reset').on('click', function () { $('span.search-reset').on('click', function () {
$('#scrollingNav .sidenav-search input.search') $('#scrollingNav .sidenav-search input.search')
.val("") .val("")
.focus() .focus();
;
endpointsList.search(); endpointsList.search();
}); });
@ -687,7 +706,9 @@ require([
reversed.forEach(function (item, index) { reversed.forEach(function (item, index) {
var parts = item.field.split("."); var parts = item.field.split(".");
if (parts.length - 1 == dot_count) { if (parts.length - 1 == dot_count) {
var fields_names = fields.map(function (item) { return item.field; }); var fields_names = fields.map(function (item) {
return item.field;
});
if (parts.slice(1).length >= 1) { if (parts.slice(1).length >= 1) {
var prefix = parts.slice(0, parts.length - 1).join("."); var prefix = parts.slice(0, parts.length - 1).join(".");
var prefix_index = fields_names.indexOf(prefix); var prefix_index = fields_names.indexOf(prefix);

Voir le fichier

@ -13,8 +13,11 @@ import (
var config *Config var config *Config
var once sync.Once var once sync.Once
// Configpaths default configuration file paths
var Configpaths = []string{"config/config.yml", "config/default_config.yml"} var Configpaths = []string{"config/config.yml", "config/default_config.yml"}
// Get config variable
func Get() *Config { func Get() *Config {
once.Do(func() { once.Do(func() {
config = &Config{} config = &Config{}

Voir le fichier

@ -54,7 +54,7 @@ func getTorrentList(c *gin.Context) (torrents []models.Torrent, createdAsTime ti
} }
if userID != "" { if userID != "" {
userIDnum := 0 var userIDnum int
userIDnum, err = strconv.Atoi(html.EscapeString(userID)) userIDnum, err = strconv.Atoi(html.EscapeString(userID))
// Should we have a feed for anonymous uploads? // Should we have a feed for anonymous uploads?
if err != nil || userIDnum == 0 { if err != nil || userIDnum == 0 {

Voir le fichier

@ -17,7 +17,7 @@ import (
// RSSTorznabHandler : Controller for displaying rss feed, accepting common search arguments // RSSTorznabHandler : Controller for displaying rss feed, accepting common search arguments
func RSSTorznabHandler(c *gin.Context) { func RSSTorznabHandler(c *gin.Context) {
t := c.Query("t") t := c.Query("t")
rss := "" var rss string
title := "Nyaa Pantsu" title := "Nyaa Pantsu"
if config.IsSukebei() { if config.IsSukebei() {
title = "Sukebei Pantsu" title = "Sukebei Pantsu"

Voir le fichier

@ -11,7 +11,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Middleware for managing errors on status // ErrorMiddleware for managing errors on status
func ErrorMiddleware() gin.HandlerFunc { func ErrorMiddleware() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
c.Next() c.Next()

Voir le fichier

@ -113,7 +113,7 @@ func torrentManyAction(c *gin.Context) {
} }
/* Changes are done, we save */ /* Changes are done, we save */
_, err := torrent.UpdateUnscope() _, err = torrent.UpdateUnscope()
if err == nil { if err == nil {
if torrent.Uploader == nil { if torrent.Uploader == nil {
torrent.Uploader = &models.User{} torrent.Uploader = &models.User{}

Voir le fichier

@ -14,7 +14,7 @@ func TorrentReassignModPanel(c *gin.Context) {
templates.Form(c, "admin/reassign.jet.html", torrentValidator.ReassignForm{}) templates.Form(c, "admin/reassign.jet.html", torrentValidator.ReassignForm{})
} }
// ExecuteAction : Function for applying the changes from ReassignForm // ExecuteReassign : Function for applying the changes from ReassignForm
func ExecuteReassign(f *torrentValidator.ReassignForm) (int, error) { func ExecuteReassign(f *torrentValidator.ReassignForm) (int, error) {
var toBeChanged []uint var toBeChanged []uint
var err error var err error

Voir le fichier

@ -17,13 +17,13 @@ import (
func SeePublicSettingsHandler(c *gin.Context) { func SeePublicSettingsHandler(c *gin.Context) {
_, Tlang := publicSettings.GetTfuncAndLanguageFromRequest(c) _, Tlang := publicSettings.GetTfuncAndLanguageFromRequest(c)
availableLanguages := publicSettings.GetAvailableLanguages() availableLanguages := publicSettings.GetAvailableLanguages()
languagesJson := templates.LanguagesJSONResponse{Tlang.Tag, availableLanguages} languagesJSON := templates.LanguagesJSONResponse{Tlang.Tag, availableLanguages}
contentType := c.Request.Header.Get("Content-Type") contentType := c.Request.Header.Get("Content-Type")
if contentType == "application/json" { if contentType == "application/json" {
c.Header("Content-Type", "application/json") c.Header("Content-Type", "application/json")
c.JSON(http.StatusOK, languagesJson) c.JSON(http.StatusOK, languagesJSON)
} else { } else {
templates.Form(c, "site/user/public/settings.jet.html", languagesJson) templates.Form(c, "site/user/public/settings.jet.html", languagesJSON)
} }
} }

Voir le fichier

@ -4,4 +4,4 @@ You can use this API without being logged or any token API
## Except for Upload ## Except for Upload
When you upload, you have to provide your username and api token! When you upload, you have to provide your username and API token!

Voir le fichier

@ -6,6 +6,7 @@ import (
"github.com/patrickmn/go-cache" "github.com/patrickmn/go-cache"
) )
// C global cache variable
var C *cache.Cache var C *cache.Cache
func init() { func init() {

Voir le fichier

@ -12,10 +12,12 @@ type Category struct {
Name string Name string
} }
// Cateogories is a struct defining an array of categories // Categories is a struct defining an array of categories
type Categories []Category type Categories []Category
var categories Categories var categories Categories
// Index variable
var Index map[string]int var Index map[string]int
// InitCategories init the categories and index variables. Exported for tests // InitCategories init the categories and index variables. Exported for tests

Voir le fichier

@ -159,7 +159,7 @@ func setUserToContext(c *gin.Context, val *models.User) {
context.Set(c.Request, UserContextKey, val) context.Set(c.Request, UserContextKey, val)
} }
// RetrieveUser retrieves a user. // RetrieveUserFromRequest retrieves a user.
func RetrieveUserFromRequest(c *gin.Context, id uint) (*models.User, bool, uint, int, error) { func RetrieveUserFromRequest(c *gin.Context, id uint) (*models.User, bool, uint, int, error) {
var user models.User var user models.User
var currentUserID uint var currentUserID uint

Voir le fichier

@ -13,7 +13,7 @@ import (
"github.com/gorilla/feeds" "github.com/gorilla/feeds"
) )
// private wrapper around the RssFeed which gives us the <rss>..</rss> xml // rssFeedXML private wrapper around the RssFeed which gives us the <rss>..</rss> xml
type rssFeedXML struct { type rssFeedXML struct {
XMLName xml.Name `xml:"rss"` XMLName xml.Name `xml:"rss"`
Xmlns string `xml:"xmlns:torznab,attr,omitempty"` Xmlns string `xml:"xmlns:torznab,attr,omitempty"`
@ -23,6 +23,7 @@ type rssFeedXML struct {
Caps *RssCaps `xml:"caps,omitempty"` Caps *RssCaps `xml:"caps,omitempty"`
} }
// RssImage RSS image struct
type RssImage struct { type RssImage struct {
XMLName xml.Name `xml:"image"` XMLName xml.Name `xml:"image"`
URL string `xml:"url"` URL string `xml:"url"`
@ -32,6 +33,7 @@ type RssImage struct {
Height int `xml:"height,omitempty"` Height int `xml:"height,omitempty"`
} }
// RssTextInput RSS text struct
type RssTextInput struct { type RssTextInput struct {
XMLName xml.Name `xml:"textInput"` XMLName xml.Name `xml:"textInput"`
Title string `xml:"title"` Title string `xml:"title"`
@ -40,11 +42,13 @@ type RssTextInput struct {
Link string `xml:"link"` Link string `xml:"link"`
} }
// RssMagnetLink RSS struct for magnet links
type RssMagnetLink struct { type RssMagnetLink struct {
XMLName xml.Name `xml:"link"` XMLName xml.Name `xml:"link"`
Text string `xml:",cdata"` Text string `xml:",cdata"`
} }
// RssFeed RSS feed struct
type RssFeed struct { type RssFeed struct {
XMLName xml.Name `xml:"channel"` XMLName xml.Name `xml:"channel"`
Xmlns string `xml:"-"` Xmlns string `xml:"-"`
@ -70,6 +74,7 @@ type RssFeed struct {
Items []*RssItem Items []*RssItem
} }
// RssItem struct for rss feed items
type RssItem struct { type RssItem struct {
XMLName xml.Name `xml:"item"` XMLName xml.Name `xml:"item"`
Title string `xml:"title"` // required Title string `xml:"title"` // required
@ -86,6 +91,7 @@ type RssItem struct {
Torznab []*RssTorznab Torznab []*RssTorznab
} }
// RssCaps xml struct for torznab caps
type RssCaps struct { type RssCaps struct {
XMLName xml.Name `xml:"caps"` XMLName xml.Name `xml:"caps"`
Server *RssServer `xml:"server,omitempty"` Server *RssServer `xml:"server,omitempty"`
@ -95,6 +101,7 @@ type RssCaps struct {
Categories *RssCategories `xml:"categories,omitempty"` Categories *RssCategories `xml:"categories,omitempty"`
} }
// RssServer basic server information
type RssServer struct { type RssServer struct {
XMLName xml.Name `xml:"server"` XMLName xml.Name `xml:"server"`
Xmlns string `xml:"xmlns,attr"` Xmlns string `xml:"xmlns,attr"`
@ -106,18 +113,21 @@ type RssServer struct {
Image string `xml:"image,attr"` Image string `xml:"image,attr"`
} }
// RssLimits struct for max results
type RssLimits struct { type RssLimits struct {
XMLName xml.Name `xml:"limits"` XMLName xml.Name `xml:"limits"`
Max string `xml:"max,attr"` Max string `xml:"max,attr"`
Default string `xml:"default,attr"` Default string `xml:"default,attr"`
} }
// RssRegistration torznab registration information
type RssRegistration struct { type RssRegistration struct {
XMLName xml.Name `xml:"registration"` XMLName xml.Name `xml:"registration"`
Available string `xml:"available,attr"` Available string `xml:"available,attr"`
Open string `xml:"open,attr"` Open string `xml:"open,attr"`
} }
// RssSearching struct for supported search types
type RssSearching struct { type RssSearching struct {
XMLName xml.Name `xml:"searching"` XMLName xml.Name `xml:"searching"`
Search *RssSearch `xml:"search,omitempty"` Search *RssSearch `xml:"search,omitempty"`
@ -125,16 +135,19 @@ type RssSearching struct {
MovieSearch *RssSearch `xml:"movie-search,omitempty"` MovieSearch *RssSearch `xml:"movie-search,omitempty"`
} }
// RssSearch struct for supported searching params
type RssSearch struct { type RssSearch struct {
Available string `xml:"available,attr"` Available string `xml:"available,attr"`
SupportedParams string `xml:"supportedParams,attr,omitempty"` SupportedParams string `xml:"supportedParams,attr,omitempty"`
} }
// RssCategories categories for rss
type RssCategories struct { type RssCategories struct {
XMLName xml.Name `xml:"categories"` XMLName xml.Name `xml:"categories"`
Category []*RssCategoryTorznab Category []*RssCategoryTorznab
} }
// RssCategoryTorznab categories for torznab
type RssCategoryTorznab struct { type RssCategoryTorznab struct {
XMLName xml.Name `xml:"category"` XMLName xml.Name `xml:"category"`
ID string `xml:"id,attr"` ID string `xml:"id,attr"`
@ -143,6 +156,7 @@ type RssCategoryTorznab struct {
Description string `xml:"description,attr,omitempty"` Description string `xml:"description,attr,omitempty"`
} }
// RssSubCat sub category
type RssSubCat struct { type RssSubCat struct {
XMLName xml.Name `xml:"subcat"` XMLName xml.Name `xml:"subcat"`
ID string `xml:"id,attr"` ID string `xml:"id,attr"`
@ -150,6 +164,7 @@ type RssSubCat struct {
Description string `xml:"description,attr,omitempty"` Description string `xml:"description,attr,omitempty"`
} }
// RssTorrent item for torrents
type RssTorrent struct { type RssTorrent struct {
XMLName xml.Name `xml:"torrent"` XMLName xml.Name `xml:"torrent"`
Xmlns string `xml:"xmlns,attr"` Xmlns string `xml:"xmlns,attr"`
@ -159,6 +174,7 @@ type RssTorrent struct {
MagnetURI string `xml:"magnetUri,omitempty"` MagnetURI string `xml:"magnetUri,omitempty"`
} }
// RssTorznab feed for torznab
type RssTorznab struct { type RssTorznab struct {
XMLName xml.Name `xml:"torznab:attr,omitempty"` XMLName xml.Name `xml:"torznab:attr,omitempty"`
Name string `xml:"name,attr,omitempty"` Name string `xml:"name,attr,omitempty"`
@ -171,6 +187,7 @@ type RssCategory struct {
Domain string `xml:"domain"` Domain string `xml:"domain"`
} }
// RssEnclosure enclosure for downloads
type RssEnclosure struct { type RssEnclosure struct {
//RSS 2.0 <enclosure url="http://example.com/file.mp3" length="123456789" type="audio/mpeg" /> //RSS 2.0 <enclosure url="http://example.com/file.mp3" length="123456789" type="audio/mpeg" />
XMLName xml.Name `xml:"enclosure"` XMLName xml.Name `xml:"enclosure"`
@ -179,6 +196,7 @@ type RssEnclosure struct {
Type string `xml:"type,attr"` Type string `xml:"type,attr"`
} }
// Rss struct
type Rss struct { type Rss struct {
*feeds.Feed *feeds.Feed
} }
@ -241,22 +259,22 @@ func (r *Rss) RssFeed() *RssFeed {
return channel return channel
} }
// FeedXml : return an XML-Ready object for an Rss object // FeedXML : return an XML-Ready object for an Rss object
func (r *Rss) FeedXml() interface{} { func (r *Rss) FeedXML() interface{} {
// only generate version 2.0 feeds for now // only generate version 2.0 feeds for now
return r.RssFeed().FeedXml() return r.RssFeed().FeedXML()
} }
// FeedXml : return an XML-ready object for an RssFeed object // FeedXML : return an XML-ready object for an RssFeed object
func (r *RssFeed) FeedXml() interface{} { func (r *RssFeed) FeedXML() interface{} {
if r.Xmlns != "" { if r.Xmlns != "" {
return &rssFeedXML{Version: "2.0", Encoding: "UTF-8", Channel: r, Xmlns: r.Xmlns} return &rssFeedXML{Version: "2.0", Encoding: "UTF-8", Channel: r, Xmlns: r.Xmlns}
} }
return &rssFeedXML{Version: "2.0", Encoding: "UTF-8", Channel: r} return &rssFeedXML{Version: "2.0", Encoding: "UTF-8", Channel: r}
} }
// FeedXml : return an XML-ready object for an RssFeed object // FeedXML : return an XML-ready object for an RssFeed object
func (r *RssCaps) FeedXml() interface{} { func (r *RssCaps) FeedXML() interface{} {
return r return r
} }

Voir le fichier

@ -29,10 +29,11 @@ var htmlFlags = 0 |
md.HTML_HREF_TARGET_BLANK md.HTML_HREF_TARGET_BLANK
func init() { func init() {
HtmlMdRenderer = md.HtmlRenderer(htmlFlags, "", "") HTMLMdRenderer = md.HtmlRenderer(htmlFlags, "", "")
} }
var HtmlMdRenderer md.Renderer // HTMLMdRenderer render for markdown to html
var HTMLMdRenderer md.Renderer
// MarkdownToHTML : convert markdown to html // MarkdownToHTML : convert markdown to html
// TODO: restrict certain types of markdown // TODO: restrict certain types of markdown
@ -41,7 +42,7 @@ func MarkdownToHTML(markdown string) template.HTML {
markdown = ">" + markdown[4:] markdown = ">" + markdown[4:]
} }
markdown = strings.Replace(markdown, "\n&gt;", "\n>", -1) markdown = strings.Replace(markdown, "\n&gt;", "\n>", -1)
unsafe := md.MarkdownOptions([]byte(markdown), HtmlMdRenderer, md.Options{Extensions: mdOptions}) unsafe := md.MarkdownOptions([]byte(markdown), HTMLMdRenderer, md.Options{Extensions: mdOptions})
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
return template.HTML(html) return template.HTML(html)
} }

Voir le fichier

@ -2,6 +2,7 @@ package structs
import "github.com/NyaaPantsu/nyaa/models" import "github.com/NyaaPantsu/nyaa/models"
// TorrentCache torrent cache struct
type TorrentCache struct { type TorrentCache struct {
Torrents []models.Torrent Torrents []models.Torrent
Count int Count int

Voir le fichier

@ -17,19 +17,34 @@ import (
) )
const ( const (
// ShowAll by default show all torrents
ShowAll Status = 0 ShowAll Status = 0
// FilterRemakes filter torrent remakes
FilterRemakes = 2 FilterRemakes = 2
// Trusted trusted torrents
Trusted = 3 Trusted = 3
// APlus torrents not used anymore
APlus = 4 APlus = 4
) )
// Status torrent status
type Status uint8 type Status uint8
// SortMode selected sort mode
type SortMode uint8 type SortMode uint8
// Category torrent categories
type Category struct { type Category struct {
Main, Sub uint8 Main, Sub uint8
} }
// SizeBytes size in bytes
type SizeBytes uint64 type SizeBytes uint64
// DateFilter date to filter for
type DateFilter string type DateFilter string
// Categories multiple torrent categories
type Categories []*Category type Categories []*Category
// TorrentParam defines all parameters that can be provided when searching for a torrent // TorrentParam defines all parameters that can be provided when searching for a torrent

Voir le fichier

@ -13,6 +13,7 @@ var intEvents struct {
funcs []func() funcs []func()
} }
// OnInterrupt handles signal interupts
func OnInterrupt(fn func()) { func OnInterrupt(fn func()) {
intEvents.lock.Lock() intEvents.lock.Lock()
intEvents.funcs = append(intEvents.funcs, fn) intEvents.funcs = append(intEvents.funcs, fn)

Voir le fichier

@ -8,6 +8,7 @@ import (
"syscall" "syscall"
) )
// Handle handles unix interupts
func Handle() { func Handle() {
chnl := make(chan os.Signal) chnl := make(chan os.Signal)
signal.Notify(chnl, syscall.SIGHUP, os.Interrupt) signal.Notify(chnl, syscall.SIGHUP, os.Interrupt)

Voir le fichier

@ -139,6 +139,7 @@ func IsUTFLetterNumericValidator(fl validator.FieldLevel) bool {
return IsUTFLetterNumeric(value) return IsUTFLetterNumeric(value)
} }
// DefaultValidator default validator
func DefaultValidator(fl validator.FieldLevel) bool { func DefaultValidator(fl validator.FieldLevel) bool {
switch fl.Field().Kind() { switch fl.Field().Kind() {
case reflect.String: case reflect.String: