use separate pd client

This commit is contained in:
2020-06-07 21:12:48 +02:00
parent 843eaf51f9
commit 1a53def1ef
32 changed files with 185 additions and 692 deletions

View File

@@ -22,7 +22,7 @@
<div class="spacer"></div>
<button id="btn_home">🏠</button> -->
<div class="spacer"></div>
<input class="breadcrumbs" type="text" value="/{{.Username}}"/>
<input class="breadcrumbs" type="text" value="/{{.User.Username}}"/>
<div class="spacer"></div>
<input id="input_search" class="input_search" type="text" placeholder="Search..."/>
<div class="spacer"></div>
@@ -51,10 +51,10 @@
let hashChange = () => {
if (window.location.hash === "#files") {
breadcrumbs.value = "/{{.Username}}/Files"
breadcrumbs.value = "/{{.User.Username}}/Files"
fm.getUserFiles()
} else if (window.location.hash === "#lists") {
breadcrumbs.value = "/{{.Username}}/Lists"
breadcrumbs.value = "/{{.User.Username}}/Lists"
fm.getUserLists()
} else {
alert("invalid file manager type")

View File

@@ -1,7 +1,7 @@
{{define "user_home"}}<!DOCTYPE html>
<html lang="en">
<head>
{{template "meta_tags" .Username}}
{{template "meta_tags" .User.Username}}
{{template "user_style" .}}
<script>var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>
@@ -9,47 +9,57 @@
<body>
{{template "page_top" .}}
<h1>Welcome home, {{.Username}}!</h1>
<h1>Welcome home, {{.User.Username}}!</h1>
<div class="page_content"><div class="limit_width">
<h2>Account information</h2>
<ul>
<li>Username: {{.Username}}</li>
<li>E-mail address: {{.Email}}</li>
</ul>
<a href="/user/settings" class="button">Update account settings</a>
<h2>Your most recently uploaded files:</h2>
<div class="highlight_dark">
{{$files := .PixelAPI.UserFiles 0 15}}
{{range $files.Files}}<!--
--><a class="file_button" href="/u/{{.ID}}" target="_blank">
<img src="{{$.APIEndpoint}}/file/{{.ID}}/thumbnail?width=80&height=80" alt="{{.Name}}" />
<span class="file_button_title">{{.Name}}</span>
<br/>
{{.DateUpload.Format "2006-01-02 15:04:05"}}
</a><!--
-->{{end}}
<br/>
<a href="/user/files" class="button">...All my files</a>
<div class="page_content">
<div class="limit_width">
<h2>Account information</h2>
<ul>
<li>Username: {{.User.Username}}</li>
<li>E-mail address: {{.User.Email}}</li>
<li>
Supporter status:
{{if eq .User.Subscription ""}}
Not a pixeldrain supporter<br/>
<a href="https://www.patreon.com/pixeldrain">Learn how to support pixeldrain</a>.
{{else}}
{{if eq .User.Subscription "patreon_1"}}
Level 1 Patreon supporter. Benefits:
<ul>
<li>No ads when viewing files</li>
</ul>
{{else if eq .User.Subscription "patreon_2"}}
Level 2 Patreon supporter. Benefits:
<ul>
<li>No ads when viewing files</li>
<li>No ads on uploaded files</li>
<li>2-month file expiry (Not implemented yet)</li>
</ul>
{{else if eq .User.Subscription "patreon_3"}}
Level 3 Patreon supporter. Benefits:
<ul>
<li>No ads when viewing files</li>
<li>No ads on uploaded files</li>
<li>6-month file expiry (Not implemented yet)</li>
</ul>
{{else if eq .User.Subscription "patreon_4"}}
Level 4 Patreon supporter. Benefits:
<ul>
<li>No ads when viewing files</li>
<li>No ads on uploaded files</li>
<li>No file expiry (Not implemented yet)</li>
</ul>
{{end}}
{{end}}
</li>
</ul>
<a href="/user/settings" class="button button_highlight">Change account settings</a>
<h2>Navigation</h2>
<a href="/" class="button">Upload files</a>
<a href="/user/filemanager#files" class="button">My files</a>
<a href="/user/filemanager#lists" class="button">My lists</a>
</div>
<h2>Your most recently created lists:</h2>
<div class="highlight_dark">
{{$lists := .PixelAPI.UserLists 0 15}}
{{range $lists.Lists}}<!--
--><a class="file_button" href="/l/{{.ID}}" target="_blank">
<img src="{{$.APIEndpoint}}/list/{{.ID}}/thumbnail?width=80&height=80" alt="{{.Title}}" />
<span class="file_button_title">{{.Title}}</span>
({{.FileCount}} Files)
<br/>
{{.DateCreated.Format "2006-01-02 15:04:05"}}
</a><!--
-->{{end}}
<br/>
<a href="/user/lists" class="button">...All my lists</a>
</div>
<br/><br/>
</div></div>
</div>
{{template "page_bottom" .}}

View File

@@ -1,7 +1,7 @@
{{define "user_settings"}}<!DOCTYPE html>
<html lang="en">
<head>
{{template "meta_tags" .Username}}
{{template "meta_tags" .User.Username}}
{{template "user_style" .}}
<script>var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>

View File

@@ -1,7 +1,7 @@
{{define "user_settings_vue_test"}}<!DOCTYPE html>
<html lang="en">
<head>
{{template "meta_tags" .Username}}
{{template "meta_tags" .User.Username}}
{{template "user_style" .}}
<script>var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>

View File

@@ -9,7 +9,7 @@
{{$isAdmin := .PixelAPI.UserIsAdmin}}
{{template "page_top" .}}
<div class="page_content">
{{if $isAdmin.IsAdmin}}
{{if $isAdmin}}
<h3>Bandwidth and views</h3>
<div class="highlight_dark">
<button onclick="setData(7, 60);">Week</button>

View File

@@ -12,7 +12,7 @@
{{$success := .URLQuery.Get "success"}}
{{if eq $success "true"}}
{{if .Authenticated}}
Dear {{.Username}},
Dear {{.User.Username}},
<br/><br/>
Thank you for your donation. I really appreciate it!
<br/><br/>

View File

@@ -69,7 +69,26 @@
<i class="icon">edit</i>
<span><u>E</u>dit</span>
</button>
{{template "advertisement" .}}
<br/>
{{if .Other.ShowAds}}
<hr/>
<!-- <div id="brave_ref" style="text-align: center; padding: 2px;"> -->
{{if ne (isBrave .UserAgent) true}}
Use the Brave web browser for a faster and safer web!<br/>
<a href="https://brave.com/pix009" id="btnBrave" class="button toolbar_button button_full_width button_highlight">
<img src="{{template `brave_lion.png`}}" alt="Brave lion"/>
<span>Get Brave</span>
</a>
<br/>
or <a href="https://medium.com/pixeldrain/advertising-on-pixeldrain-a-more-honest-approach-d5e00e3f0c29">learn why pixeldrain supports Brave</a>
{{else}}
Thank you for using Brave! Please consider supporting pixeldrain with a tip
<img src="{{template `bat_logo_color.png`}}" style="height: 1em; width: 1em;" />
{{end}}
<!-- </div> -->
<br/>
{{end}}
<!-- This frame will load the download URL when a download button is pressed -->
<iframe id="download_frame" style="display: none; width: 1px; height: 1px;"></iframe>
@@ -99,6 +118,7 @@
</div>
</div>
{{if .Other.ShowAds}}
<div id="sponsors" class="sponsors">
{{if eq .Other.AdType 0}}
<!-- scrolling="no" is not allowed by the W3C, but overflow: hidden doesn't work in chrome, so I have no choice -->
@@ -114,6 +134,7 @@
</a>
{{end}}
</div>
{{end}}
</div>
<template id="tpl_details_popup">

View File

@@ -1,18 +0,0 @@
{{define "advertisement"}}
<br/><hr/>
<div id="brave_ref" style="text-align: center; padding: 2px;">
{{if ne (isBrave .UserAgent) true}}
Use the Brave web browser for a faster and safer web!<br/>
<a href="https://brave.com/pix009" id="btnBrave" class="button toolbar_button button_full_width button_highlight">
<img src="{{template `brave_lion.png`}}" alt="Brave lion"/>
<span>Get Brave</span>
</a>
<br/>
or <a href="https://medium.com/pixeldrain/advertising-on-pixeldrain-a-more-honest-approach-d5e00e3f0c29">learn why pixeldrain supports Brave</a>
{{else}}
Thank you for using Brave! Please consider supporting pixeldrain with a tip
<img src="{{template `bat_logo_color.png`}}" style="height: 1em; width: 1em;" />
{{end}}
</div>
<br/>
{{end}}

View File

@@ -3,7 +3,7 @@
<div id="page_navigation" class="page_navigation">
<a href="/">Home</a>
<hr />
{{if .Authenticated}}<a href="/user">{{.Username}}</a>
{{if .Authenticated}}<a href="/user">{{.User.Username}}</a>
<a href="/user/filemanager#files">My Files</a>
<a href="/user/filemanager#lists">My Lists</a>
<a href="/logout">Log out</a>
@@ -42,10 +42,17 @@
{{define "page_bottom"}}
<div class="highlight_dark">
Pixeldrain is a product by <a href="//fornaxian.com" target="_blank">Fornaxian Technologies</a> |
Twitter:&nbsp;<a href="https://twitter.com/Fornax96" target="_blank">@Fornax96</a>
Reddit:&nbsp;<a href="https://reddit.com/r/pixeldrain" target="_blank">/r/pixeldrain</a>
Medium:&nbsp;<a href="https://medium.com/pixeldrain" target="_blank">Pixeldrain</a>
<div style="display: inline-block; margin: 0 8px 0 8px;">
Pixeldrain is a product by <a href="//fornaxian.com" target="_blank">Fornaxian Technologies</a>
</div>
<div style="display: inline-block; margin: 0 8px 0 8px;">
(
<a href="https://www.patreon.com/pixeldrain" target="_blank">{{template `patreon.svg` .}} Patreon</a> |
<a href="https://twitter.com/Fornax96" target="_blank">{{template `twitter.svg` .}} Twitter</a> |
<a href="https://reddit.com/r/pixeldrain" target="_blank">{{template `reddit.svg` .}} Reddit</a> |
<a href="https://medium.com/pixeldrain" target="_blank">{{template `medium.svg` .}} Medium</a>
)
</div>
<br/>
<span class="small_footer_text" style="font-size: .75em; line-height: .75em;">
page rendered by {{.Hostname}}

View File

@@ -1,22 +0,0 @@
{{define "hide_refer"}}<!DOCTYPE html>
<html>
<head>
<title>You are being redirected</title>
<!-- <meta http-equiv="refresh" content="0; {{.}}" /> -->
<style>html, body {background-color: #000000;}</style>
</head>
<body>
You are being redirected.<br/>
<br/>
If it doesn't work. <a id="link" href="{{.}}">Click here</a>.
<script>
var a = document.getElementById("link");
if(!a.click) {
window.location = "{{.}}";
}
a.click();
</script>
</body>
</html>
{{end}}

View File

@@ -56,7 +56,6 @@
</a>
<br/><br/>
Tip: Save your file with extension '.md' to use markdown formatting<br/>
{{template "advertisement" .}}
</div>
<div class="textarea_container">
<textarea id="textarea" class="textarea" placeholder="Your text here..." autofocus="autofocus"></textarea>