+
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
-
-
Advertisements
-
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)
}