diff --git a/res/static/img/benefit_6.png b/res/static/img/benefit_6.png new file mode 100644 index 0000000..b450c61 Binary files /dev/null and b/res/static/img/benefit_6.png differ diff --git a/res/static/img/benefit_6_small.png b/res/static/img/benefit_6_small.png new file mode 100644 index 0000000..0fb8585 Binary files /dev/null and b/res/static/img/benefit_6_small.png differ diff --git a/res/static/img/sharex.png b/res/static/img/sharex.png new file mode 100644 index 0000000..7344936 Binary files /dev/null and b/res/static/img/sharex.png differ diff --git a/res/static/img/sharex_default.png b/res/static/img/sharex_default.png new file mode 100644 index 0000000..b328e90 Binary files /dev/null and b/res/static/img/sharex_default.png differ diff --git a/res/static/img/sharex_download.png b/res/static/img/sharex_download.png new file mode 100644 index 0000000..d792d9b Binary files /dev/null and b/res/static/img/sharex_download.png differ diff --git a/res/template/apps.html b/res/template/apps.html new file mode 100644 index 0000000..9be47f7 --- /dev/null +++ b/res/template/apps.html @@ -0,0 +1,69 @@ +{{ define "apps" }} + + + {{template "meta_tags" "Apps"}} + {{template "user_style" .}} + + + + {{template "page_top" .}} +

Apps

+
+

ShareX (Windows only)

+

+ +

+

+ ShareX is a Screen capture, file sharing and productivity tool. + Pixeldrain is supported as a custom uploader. You can get ShareX + here. +

+

+ Here you can download our custom ShareX uploader which uses + pixeldrain to upload your files. +

+ +
+ + save + Download ShareX Uploader +
+ + {{if .Authenticated}} + This uploader is configured to upload files to your personal + pixeldrain account. Do not share the configuration file with + anyone, it contains your account credentials. + {{else}} + Log in to use ShareX with your own + pixeldrain account. {{end}} +
+ +

Setting pixeldrain as default uploader

+

+ Download the uploader config and choose 'Open file'
+
+ Set pixeldrain.com as active uploader. Choose Yes
+
+

+ +

pdup (Linux only)

+

+ pdup is a little bash script for uploading files to pixeldrain + from the terminal. It's available from + GitHub. +

+ +

More apps

+

+ If you know more open source apps which work with pixeldrain + please send them to + support@pixeldrain.com. +

+
+ {{template "page_bottom" .}} + {{template "analytics"}} + + +{{ end }} diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html index 05b60d8..8fca0d5 100644 --- a/res/template/file_viewer.html +++ b/res/template/file_viewer.html @@ -155,33 +155,33 @@ {{ else if eq .Other.AdType 8 }} -
- -
+
+ +
Are your files expiring too quickly?
Pixeldrain Pro: Only €2 per month
{{ else if eq .Other.AdType 9 }} -
- -
+
+ +
Are your files too large to share?
Pixeldrain Pro: Only €2 per month
{{ else if eq .Other.AdType 10 }} -
- -
+
+ +
Are you tired of advertisements?
Pixeldrain Pro: Only €2 per month
{{ else if eq .Other.AdType 11 }} -
- -
+
+ +
Concerned about your online privacy?
Pixeldrain Pro: Only €2 per month
diff --git a/res/template/fragments/page_wrap.html b/res/template/fragments/page_wrap.html index 4b53573..38c4f02 100644 --- a/res/template/fragments/page_wrap.html +++ b/res/template/fragments/page_wrap.html @@ -15,6 +15,7 @@ {{end}}
About + Apps Appearance API Acknowledgements diff --git a/res/template/home.html b/res/template/home.html index 7993130..cb77493 100644 --- a/res/template/home.html +++ b/res/template/home.html @@ -57,15 +57,9 @@ margin: 5px 15px; } - .table_container { - width: 100%; - overflow-x: auto; - overflow-y: hidden; - } .feat_table { display: flex; flex-direction: column; - min-width: 400px; } .feat_table > div { display: flex; @@ -77,7 +71,7 @@ } .feat_table > div > div { flex: 1 1 0; - margin: 0.2em; + margin: 0.25em; padding: 0.5em; text-align: center; word-wrap: break-word; @@ -107,6 +101,13 @@ font-size: 1.1em; font-weight: bold; } + .feat_table > div > .cell_background { + background-position: center; + background-size: cover; + text-align: left; + font-size: 1.2em; + padding: 0.2em; + } .feat_table > div > div.round_tl { border-top-left-radius: 0.5em; } .feat_table > div > div.round_tr { border-top-right-radius: 0.5em; } @@ -225,68 +226,149 @@ mission to make content sharing easier, safer and faster for everyone.

-
-
-
-
-
Free
-
Pro
+
+
+
+
Free
+
Pro
+
+
+
Size limit per file
+
5 GB per file
+
15 GB per file
+
+
+ +
30 days after the last time it is viewed
+
90 days after the last time it is viewed
+
+
+
Adver­tise­ments
+
Pop-up or a banner ad on the file viewer page
+
+ No ads on files + you share. No ads when viewing files uploaded by + other users
-
-
Size limit per file
-
5 GB per file
-
15 GB per file
+
+
+
Privacy
+
+ No trackers, but advertisers can see your IP address + and browser fingerprint
-
- -
30 days after the last time it is viewed
-
90 days after the last time it is viewed
+
+ Completely + private. No third party scripts and no + logging
-
-
Adver­tise­ments
-
Pop-up or a banner ad on the file viewer page
-
- No ads on files - you share. No ads when viewing files uploaded by - other users -
-
-
-
Privacy
-
- No trackers, but advertisers can see your IP address - and browser fingerprint -
-
- Completely - private. No third party scripts and no - logging -
-
-
-
Online file previews
-
View image, video, audio, PDF and text files directly in your web browser
-
-
- -
Rate limiting mode will be enabled when a file has 3 times more downloads than views
-
-
-
-
Free
-
- {{if ne .User.Subscription.ID ""}} - You have this plan
- Thank you for supporting pixeldrain! - {{else}} - Only € 2 per month! (Excluding tax) -
- Subscription managed by Patreon - {{end}} -
+
+
+
Online file previews
+
View image, video, audio, PDF and text files directly in your web browser
+
+
+ +
Rate limiting mode will be enabled when a file has 3 times more downloads than views
+
+
+
+
Free
+
+ {{if eq .User.Subscription.ID "patreon_1"}} + You have this plan
+ Thank you for supporting pixeldrain! + {{else}} + Only € 2 per month! (Excluding tax) +
+ Subscription managed by Patreon + {{end}}
+

+
+ Do you need even more time and space? Check out our other plans +
+
+
+
+
Resolve
+
+ 20 GB file size, + 120 days file expiry +
+
+ {{if eq .User.Subscription.ID "patreon_5"}} + You have this plan
+ Thank you for supporting pixeldrain! + {{else}} + € 4 + {{end}} +
+
+
+
Persistence
+
+ 20 GB file size, + 240 days file expiry +
+
+ {{if eq .User.Subscription.ID "patreon_2"}} + You have this plan
+ Thank you for supporting pixeldrain! + {{else}} + € 8 + {{end}} +
+
+
+
Tenacity
+
+ 20 GB file size, + 480 days file expiry +
+
+ {{if eq .User.Subscription.ID "patreon_3"}} + You have this plan
+ Thank you for supporting pixeldrain! + {{else}} + € 16 + {{end}} +
+
+
+
Eternity
+
+ 20 GB file size, + 960 days file expiry +
+
+ {{if eq .User.Subscription.ID "patreon_4"}} + You have this plan
+ Thank you for supporting pixeldrain! + {{else}} + € 32 + {{end}} +
+
+
+
Infinity
+
+ 20 GB file size, + 1920 days file expiry +
+
+ {{if eq .User.Subscription.ID "patreon_6"}} + You have this plan
+ Thank you for supporting pixeldrain! + {{else}} + € 64 + {{end}} +
+
+
+

Premium

diff --git a/webcontroller/misc.go b/webcontroller/misc.go new file mode 100644 index 0000000..9bf4153 --- /dev/null +++ b/webcontroller/misc.go @@ -0,0 +1,61 @@ +package webcontroller + +import ( + "encoding/base64" + "fmt" + "net/http" + + "github.com/Fornaxian/log" + "github.com/julienschmidt/httprouter" +) + +// ServeFileViewerDemo is a dummy API response that responds with info about a +// non-existent demo file. This is required by the a-ads ad network to allow for +// automatic checking of the presence of the ad unit on this page. +func (wc *WebController) serveShareXConfig(w http.ResponseWriter, r *http.Request, p httprouter.Params) { + templateData := wc.newTemplateData(w, r) + + w.Header().Add("Content-Disposition", "attachment; filename=pixeldrain.com.sxcu") + if templateData.Authenticated { + sess, err := templateData.PixelAPI.UserSessionCreate() + if err != nil { + log.Error("Failed to create user session: %s", err) + wc.templates.Get().ExecuteTemplate(w, "500", templateData) + return + } + + w.Write([]byte(fmt.Sprintf( + `{ + "Version": "12.4.1", + "DestinationType": "ImageUploader, TextUploader, FileUploader", + "RequestMethod": "POST", + "RequestURL": "https://pixeldrain.com/api/file", + "Headers": { + "Authorization": "Basic %s" + }, + "Body": "MultipartFormData", + "FileFormName": "file", + "URL": "https://pixeldrain.com/u/$json:id$", + "ThumbnailURL": "https://pixeldrain.com/api/file/$json:id$/thumbnail" +} +`, + base64.StdEncoding.EncodeToString([]byte( + templateData.User.Username+":"+sess.AuthKey.String(), + )), + ))) + } else { + w.Write([]byte(fmt.Sprintf( + `{ + "Version": "12.4.1", + "DestinationType": "ImageUploader, TextUploader, FileUploader", + "RequestMethod": "POST", + "RequestURL": "https://pixeldrain.com/api/file", + "Body": "MultipartFormData", + "FileFormName": "file", + "URL": "https://pixeldrain.com/u/$json:id$", + "ThumbnailURL": "https://pixeldrain.com/api/file/$json:id$/thumbnail" +} +`, + ))) + } +} diff --git a/webcontroller/templates.go b/webcontroller/templates.go index 2263e01..5d4796b 100644 --- a/webcontroller/templates.go +++ b/webcontroller/templates.go @@ -71,7 +71,7 @@ func (wc *WebController) newTemplateData(w http.ResponseWriter, r *http.Request) if err.Error() == "authentication_required" || err.Error() == "authentication_failed" { // Disable API authentication - t.PixelAPI = wc.api + t.PixelAPI = wc.api.RealIP(util.RemoteAddress(r)) // Remove the authentication cookie log.Debug("Deleting invalid API key") diff --git a/webcontroller/user_account.go b/webcontroller/user_account.go index f6e0d83..01e1967 100644 --- a/webcontroller/user_account.go +++ b/webcontroller/user_account.go @@ -148,8 +148,10 @@ func (wc *WebController) loginForm(td *TemplateData, r *http.Request) (f Form) { } if f.ReadInput(r) { - loginResp, err := td.PixelAPI.UserLogin(f.FieldVal("username"), f.FieldVal("password")) - if err != nil { + if session, err := td.PixelAPI.UserLogin( + f.FieldVal("username"), + f.FieldVal("password"), + ); err != nil { formAPIError(err, &f) } else { // Request was a success @@ -159,7 +161,7 @@ func (wc *WebController) loginForm(td *TemplateData, r *http.Request) (f Form) { // Set the autentication cookie f.Extra.SetCookie = &http.Cookie{ Name: "pd_auth_key", - Value: loginResp.APIKey, + Value: session.AuthKey.String(), Path: "/", Expires: time.Now().AddDate(50, 0, 0), Domain: wc.sessionCookieDomain, diff --git a/webcontroller/web_controller.go b/webcontroller/web_controller.go index 51c1f68..a227e02 100644 --- a/webcontroller/web_controller.go +++ b/webcontroller/web_controller.go @@ -123,6 +123,7 @@ func New( {GET, "acknowledgements" /**/, wc.serveMarkdown("acknowledgements.md", false)}, {GET, "business" /* */, wc.serveMarkdown("business.md", false)}, {GET, "server_status" /* */, wc.serveTemplate("server_status", false)}, + {GET, "apps" /* */, wc.serveTemplate("apps", false)}, // User account pages {GET, "register" /* */, wc.serveForm(wc.registerForm, false)}, @@ -164,6 +165,9 @@ func New( {GET, "click/:id" /* */, wc.serveAdClick}, {GET, "campaign/:id" /* */, wc.serveCampaignPartner}, {GET, "ad/revenuehits" /**/, wc.serveTemplate("revenuehits", false)}, + + // Misc + {GET, "misc/sharex/pixeldrain.com.sxcu", wc.serveShareXConfig}, } { r.Handle(h.method, prefix+"/"+h.path, h.handler) }