Bring back large file message and update dependencies

This commit is contained in:
2022-03-07 17:12:26 +01:00
parent b9ade1801c
commit 58bc2e112b
9 changed files with 62 additions and 23 deletions

10
go.mod
View File

@@ -7,21 +7,21 @@ replace fornaxian.tech/pixeldrain_api_client => ../pixeldrain_api_client
require (
fornaxian.tech/config v0.0.0-20211108212237-6133aed90586
fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640
fornaxian.tech/pixeldrain_api_client v0.0.0-20220127185304-6a60644d957e
fornaxian.tech/pixeldrain_api_client v0.0.0-20220305171318-e1197ab3d4c0
fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787
github.com/julienschmidt/httprouter v1.3.0
github.com/microcosm-cc/bluemonday v1.0.17
github.com/microcosm-cc/bluemonday v1.0.18
github.com/russross/blackfriday/v2 v2.1.0
)
require (
github.com/BurntSushi/toml v1.0.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/gocql/gocql v0.0.0-20211222173705-d73e6b1002a7 // indirect
github.com/gocql/gocql v0.0.0-20220224095938-0eacd3183625 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
)

16
go.sum
View File

@@ -16,8 +16,8 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gocql/gocql v0.0.0-20211015133455-b225f9b53fa1/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8=
github.com/gocql/gocql v0.0.0-20211222173705-d73e6b1002a7 h1:jmIMM+nEO+vjz9xaRIg9sZNtNLq5nsSbsxwe1OtRwv4=
github.com/gocql/gocql v0.0.0-20211222173705-d73e6b1002a7/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8=
github.com/gocql/gocql v0.0.0-20220224095938-0eacd3183625 h1:6ImvI6U901e1ezn/8u2z3bh1DZIvMOia0yTSBxhy4Ao=
github.com/gocql/gocql v0.0.0-20220224095938-0eacd3183625/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
@@ -32,8 +32,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/microcosm-cc/bluemonday v1.0.17 h1:Z1a//hgsQ4yjC+8zEkV8IWySkXnsxmdSY642CTFQb5Y=
github.com/microcosm-cc/bluemonday v1.0.17/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM=
github.com/microcosm-cc/bluemonday v1.0.18 h1:6HcxvXDAi3ARt3slx6nTesbvorIc3QeTzBNRvWktHBo=
github.com/microcosm-cc/bluemonday v1.0.18/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -41,13 +41,13 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20201217014255-9d1352758620/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE=
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View File

@@ -13,14 +13,11 @@ onMount(() => {
return
}
switch (Math.floor(Math.random()*3)) {
switch (Math.floor(Math.random()*2)) {
case 0:
set_ad_type("ads.plus")
break
case 1:
set_ad_type("pixfuture")
break
case 2:
case 1:
set_ad_type("nextmillennium")
break
}
@@ -138,8 +135,9 @@ head.valueimpression_loaded.subscribe(v => {
<div bind:this={banner} class="banner" id='div-gpt-ad-pixeldraincom728x90_1' style='width: 728px; height: 90px;'>
</div>
{:else if ad_type === "pixfuture"}
<!-- We don't bind the pixfuture ad to the banner variable because pixfuture does its own scaling -->
<!-- AuctionX Display platform tag START -->
<div bind:this={banner} class="banner" id="27517x728x90x4605x_ADSLOT1" clickTrack="%%CLICK_URL_ESC%%"></div>
<div class="banner" id="27517x728x90x4605x_ADSLOT1" clickTrack="%%CLICK_URL_ESC%%"></div>
<script type="text/javascript" async src="https://served-by.pixfuture.com/www/delivery/headerbid.js" slotId="27517x728x90x4605x_ADSLOT1" refreshTime="5" refreshInterval="60"></script>
<!-- AuctionX Display platform tag END -->
{:else if ad_type === "adaround"}

View File

@@ -1,5 +1,6 @@
<script>
import { createEventDispatcher, tick } from "svelte";
import LargeFileMessage from "./LargeFileMessage.svelte";
let dispatch = createEventDispatcher()
export let file = {
@@ -85,6 +86,9 @@ const toggle_play = () => playing ? player.pause() : player.play()
<source src={file.get_href} type={file.mime_type} />
</audio>
{/if}
<br/><br/>
<LargeFileMessage file={file}></LargeFileMessage>
</div>
<style>

View File

@@ -1,5 +1,6 @@
<script>
import { createEventDispatcher } from "svelte";
import LargeFileMessage from "./LargeFileMessage.svelte";
import TextBlock from "./TextBlock.svelte";
let dispatch = createEventDispatcher()
@@ -26,6 +27,9 @@ let file = {
</button>
</TextBlock>
<br/><br/>
<LargeFileMessage file={file}></LargeFileMessage>
<style>
h1 {
text-shadow: 1px 1px 3px var(--shadow_color);

View File

@@ -0,0 +1,29 @@
<script>
import { formatDuration } from "../../util/Formatting.svelte";
import TextBlock from "./TextBlock.svelte";
export let file = {
id: "",
name: "",
show_ads: false,
size: 0,
download_speed_limit: 0,
}
</script>
{#if file.show_ads && file.size > 1e8 && file.download_speed_limit > 0}
<!-- If the file is larger than 100 MB we show a warning about the transfer speed -->
<TextBlock width="700px" center={true}>
Your download speed is currently limited to
{file.download_speed_limit/(1<<20)} MiB/s. Though your download might be
slower if the servers are overloaded. Downloading this file for free
will take at least
{formatDuration((file.size/file.download_speed_limit)*1000)} (under
ideal conditions). You can
<a href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291427&cadence=12">
support Pixeldrain on Patreon
</a>
to download at the highest speed available.
</TextBlock>
{/if}

View File

@@ -50,8 +50,8 @@ onMount(async () => {
<ul>
<li>Come back tomorrow when your free transfer limit resets</li>
<li>
Download the file at a rate of {file.download_speed_limit/(1<<20)}
MiB/s. This will take at least
Download the file at a rate of {file.download_speed_limit/(1<<10)}
kiB/s. This will take at least
{formatDuration((file.size/file.download_speed_limit)*1000)}
</li>
<li>

View File

@@ -1,5 +1,6 @@
<script>
import { onMount, createEventDispatcher, tick } from "svelte";
import LargeFileMessage from "./LargeFileMessage.svelte";
import TextBlock from "./TextBlock.svelte";
let dispatch = createEventDispatcher()
@@ -163,6 +164,9 @@ const fullscreen = () => {
<i class="icon">bolt</i> Support Pixeldrain on Patreon
</a>
</TextBlock>
<br/><br/>
<LargeFileMessage file={file}></LargeFileMessage>
{/if}
<style>

View File

@@ -45,8 +45,8 @@ onMount(() => {
Data transfer limit
</div>
<div class="feat_normal">
10 GB data transfer per 24 hours. When this threshold is reached
your download speed will be limited
5 GB data transfer per 24 hours. When this threshold is reached
your download speed will be reduced to 512 kiB/s
</div>
<div class="feat_pro">
Transfer limit of <span class="text_highlight">1 terabyte</span> per