Increase text file preview size

This commit is contained in:
2021-12-09 22:16:52 +01:00
parent 893163bb4f
commit c161187fbe
4 changed files with 20 additions and 22 deletions

View File

@@ -42,7 +42,7 @@ let text_pre
const text = () => {
text_type = "text"
if (file.size > 1 << 20) { // File larger than 1 MiB
if (file.size > 1 << 22) { // File larger than 4 MiB
text_pre.innerText = "File is too large to view online.\nPlease download and view it locally."
return
}
@@ -62,7 +62,7 @@ let prettyprint = false
const code = () => {
text_type = "code"
if (file.size > 1 << 20) { // File larger than 1 MiB
if (file.size > 1 << 22) { // File larger than 4 MiB
code_pre.innerText = "File is too large to view online.\nPlease download and view it locally."
return
}

View File

@@ -74,9 +74,9 @@ let download = () => { dispatch("download", {}) }
<h1>This is a video file on pixeldrain</h1>
<img src={file.icon_href} alt="Video icon" style="display: inline-block; vertical-align: top;">
<div class="description">
The online video player on pixeldrain has been disabled due to
repeated abuse. You can still watch videos online by upgrading to
Pro. Or download the video and watch it locally on your computer.
The online video player on pixeldrain has been disabled to prevent
abuse. You can still watch videos online by upgrading to Pro. Or
download the video and watch it locally on your computer.
<br/>
<a href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291427&cadence=12" class="button button_highlight">
<i class="icon">upgrade</i> Upgrade to Pro
@@ -126,6 +126,6 @@ let download = () => { dispatch("download", {}) }
text-align: left;
padding-left: 8px;
vertical-align: middle;
max-width: 600px;
max-width: 550px;
}
</style>

View File

@@ -141,21 +141,19 @@ onMount(() => {
deposit has to be used up.
</p>
<div class="indent" style="text-align: center;">
<form on:submit|preventDefault={() => {checkout("")}} class="checkout_form">
Deposit amount €
<input type="number" bind:value={credit_amount} min="1"/>
<br/>
Pay with:<br/>
<button on:click={() => {checkout("btc")}}>
<span class="icon_unicode"></span> Bitcoin
</button>
<button on:click={() => {checkout("btc_lightning")}}>
<i class="icon">bolt</i> Lightning network
</button>
<button on:click={() => {checkout("doge")}}>
<span class="icon_unicode">Ð</span> Dogecoin
</button>
</form>
Deposit amount €
<input type="number" bind:value={credit_amount} min="1"/>
<br/>
Pay with:<br/>
<button on:click={() => {checkout("btc")}}>
<span class="icon_unicode"></span> Bitcoin
</button>
<button on:click={() => {checkout("btc_lightning")}}>
<i class="icon">bolt</i> Lightning network
</button>
<button on:click={() => {checkout("doge")}}>
<span class="icon_unicode">Ð</span> Dogecoin
</button>
</div>
<h3>Open invoices</h3>

View File

@@ -31,7 +31,7 @@ func (wc *WebController) serveFilePreview(w http.ResponseWriter, r *http.Request
if strings.HasPrefix(file.MimeType, "text") &&
(strings.HasSuffix(file.Name, ".md") || strings.HasSuffix(file.Name, ".markdown")) {
if file.Size > 1e6 { // Prevent out of memory errors
if file.Size > 1<<22 { // Prevent out of memory errors
w.Write([]byte("File is too large to view online.\nPlease download and view it locally."))
return
}