From 2d1cfb7d898eb3106e0fd46efaf904c3c8a3090f Mon Sep 17 00:00:00 2001 From: Kebert Xela Date: Tue, 21 May 2019 09:26:26 -0700 Subject: [PATCH] Acronym lints --- README.md | 2 +- server.go | 14 +++++++------- server_test.go | 6 +++--- static/js/dropzone.js | 10 +++++----- torrent.go | 4 ++-- torrent/torrent.go | 2 +- torrent_test.go | 4 ++-- upload.go | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 960b607..1bc19aa 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ The following storage backends are available: - ```-keyfile path/to/your.key``` -- Path to the ssl key (required if you want to use the https server) #### Use with http proxy -- ```-realIP``` -- let linx-server know you (nginx, etc) are providing the X-Real-IP and/or X-Forwarded-For headers. +- ```-RealIP``` -- let linx-server know you (nginx, etc) are providing the X-Real-IP and/or X-Forwarded-For headers. #### Use with fastcgi - ```-fastcgi``` -- serve through fastcgi diff --git a/server.go b/server.go index e4e1661..03fd92c 100644 --- a/server.go +++ b/server.go @@ -13,7 +13,7 @@ import ( "strings" "time" - "github.com/GeertJohan/go.rice" + rice "github.com/GeertJohan/go.rice" "github.com/andreimarcu/linx-server/backends" "github.com/andreimarcu/linx-server/backends/localfs" "github.com/andreimarcu/linx-server/backends/s3" @@ -52,7 +52,7 @@ var Config struct { xFrameOptions string maxSize int64 maxExpiry uint64 - realIp bool + RealIP bool noLogs bool allowHotlink bool fastcgi bool @@ -83,7 +83,7 @@ func setup() *web.Mux { // middleware mux.Use(middleware.RequestID) - if Config.realIp { + if Config.RealIP { mux.Use(middleware.RealIP) } @@ -124,12 +124,12 @@ func setup() *web.Mux { Config.siteURL = Config.siteURL + "/" } - parsedUrl, err := url.Parse(Config.siteURL) + parsedURL, err := url.Parse(Config.siteURL) if err != nil { log.Fatal("Could not parse siteurl:", err) } - Config.sitePath = parsedUrl.Path + Config.sitePath = parsedURL.Path } else { Config.sitePath = "/" } @@ -222,7 +222,7 @@ func main() { flag.StringVar(&Config.siteName, "sitename", "", "name of the site") flag.StringVar(&Config.siteURL, "siteurl", "", - "site base url (including trailing slash)") + "site base URL (including trailing slash)") flag.StringVar(&Config.selifPath, "selifpath", "selif", "path relative to site base url where files are accessed directly") flag.Int64Var(&Config.maxSize, "maxsize", 4*1024*1024*1024, @@ -233,7 +233,7 @@ func main() { "path to ssl certificate (for https)") flag.StringVar(&Config.keyFile, "keyfile", "", "path to ssl key (for https)") - flag.BoolVar(&Config.realIp, "realip", false, + flag.BoolVar(&Config.RealIP, "RealIP", false, "use X-Real-IP/X-Forwarded-For headers as original host") flag.BoolVar(&Config.fastcgi, "fastcgi", false, "serve through fastcgi") diff --git a/server_test.go b/server_test.go index fc225ce..229415b 100644 --- a/server_test.go +++ b/server_test.go @@ -19,7 +19,7 @@ import ( type RespOkJSON struct { Filename string - Url string + URL string Delete_Key string Expiry string Size string @@ -1277,7 +1277,7 @@ func TestPutAndGetCLI(t *testing.T) { // request file without wget user agent w = httptest.NewRecorder() - req, err = http.NewRequest("GET", myjson.Url, nil) + req, err = http.NewRequest("GET", myjson.URL, nil) if err != nil { t.Fatal(err) } @@ -1290,7 +1290,7 @@ func TestPutAndGetCLI(t *testing.T) { // request file with wget user agent w = httptest.NewRecorder() - req, err = http.NewRequest("GET", myjson.Url, nil) + req, err = http.NewRequest("GET", myjson.URL, nil) req.Header.Set("User-Agent", "wget") if err != nil { t.Fatal(err) diff --git a/static/js/dropzone.js b/static/js/dropzone.js index 76831c8..bdf47a1 100644 --- a/static/js/dropzone.js +++ b/static/js/dropzone.js @@ -303,7 +303,7 @@ } return this._updateMaxFilesReachedClass(); }, - thumbnail: function(file, dataUrl) { + thumbnail: function(file, dataURL) { var thumbnailElement, _i, _len, _ref; if (file.previewElement) { file.previewElement.classList.remove("dz-file-preview"); @@ -311,7 +311,7 @@ for (_i = 0, _len = _ref.length; _i < _len; _i++) { thumbnailElement = _ref[_i]; thumbnailElement.alt = file.name; - thumbnailElement.src = dataUrl; + thumbnailElement.src = dataURL; } return setTimeout(((function(_this) { return function() { @@ -1061,13 +1061,13 @@ } return; } - return _this.createThumbnailFromUrl(file, fileReader.result, callback); + return _this.createThumbnailFromURL(file, fileReader.result, callback); }; })(this); return fileReader.readAsDataURL(file); }; - Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback) { + Dropzone.prototype.createThumbnailFromURL = function(file, imageURL, callback) { var img; img = document.createElement("img"); img.onload = (function(_this) { @@ -1097,7 +1097,7 @@ if (callback != null) { img.onerror = callback; } - return img.src = imageUrl; + return img.src = imageURL; }; Dropzone.prototype.processQueue = function() { diff --git a/torrent.go b/torrent.go index c5e7a58..07faf77 100644 --- a/torrent.go +++ b/torrent.go @@ -15,7 +15,7 @@ import ( ) func createTorrent(fileName string, f io.Reader, r *http.Request) ([]byte, error) { - url := getSiteURL(r) + Config.selifPath + fileName + URL := getSiteURL(r) + Config.selifPath + fileName chunk := make([]byte, torrent.TORRENT_PIECE_LENGTH) t := torrent.Torrent{ @@ -24,7 +24,7 @@ func createTorrent(fileName string, f io.Reader, r *http.Request) ([]byte, error PieceLength: torrent.TORRENT_PIECE_LENGTH, Name: fileName, }, - UrlList: []string{url}, + URLList: []string{URL}, } for { diff --git a/torrent/torrent.go b/torrent/torrent.go index a47d884..073dc81 100644 --- a/torrent/torrent.go +++ b/torrent/torrent.go @@ -18,7 +18,7 @@ type TorrentInfo struct { type Torrent struct { Encoding string `bencode:"encoding"` Info TorrentInfo `bencode:"info"` - UrlList []string `bencode:"url-list"` + URLList []string `bencode:"url-list"` } func HashPiece(piece []byte) []byte { diff --git a/torrent_test.go b/torrent_test.go index 1d227fd..5138560 100644 --- a/torrent_test.go +++ b/torrent_test.go @@ -47,8 +47,8 @@ func TestCreateTorrent(t *testing.T) { } tracker := fmt.Sprintf("%s%s%s", Config.siteURL, Config.selifPath, fileName) - if decoded.UrlList[0] != tracker { - t.Fatalf("First entry in URL list was %s, expected %s", decoded.UrlList[0], tracker) + if decoded.URLList[0] != tracker { + t.Fatalf("First entry in URL list was %s, expected %s", decoded.URLList[0], tracker) } } diff --git a/upload.go b/upload.go index ca64797..073121b 100644 --- a/upload.go +++ b/upload.go @@ -170,15 +170,15 @@ func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) { } upReq := UploadRequest{} - grabUrl, _ := url.Parse(r.FormValue("url")) + grabURL, _ := url.Parse(r.FormValue("url")) - resp, err := http.Get(grabUrl.String()) + resp, err := http.Get(grabURL.String()) if err != nil { oopsHandler(c, w, r, RespAUTO, "Could not retrieve URL") return } - upReq.filename = filepath.Base(grabUrl.Path) + upReq.filename = filepath.Base(grabURL.Path) upReq.src = http.MaxBytesReader(w, resp.Body, Config.maxSize) upReq.deleteKey = r.FormValue("deletekey") upReq.randomBarename = r.FormValue("randomize") == "yes"