Enable propellerads

This commit is contained in:
2020-11-26 11:13:27 +01:00
parent fd2a9234ad
commit 99568f2da3
9 changed files with 70 additions and 6877 deletions

View File

@@ -21,7 +21,7 @@ function Viewer(type, viewToken, data) {
// On small screens the toolbar takes too much space, so it collapses // On small screens the toolbar takes too much space, so it collapses
// automatically // automatically
if (this.divFilepreview.clientWidth > 800 && !this.toolbar.visible) { if (this.divFilepreview.clientWidth > 600 && !this.toolbar.visible) {
this.toolbar.toggle() this.toolbar.toggle()
} }

View File

@@ -1,12 +0,0 @@
.file_viewer.svelte-in5te4.svelte-in5te4.svelte-in5te4{position:absolute;display:flex;flex-direction:column;top:0;right:0;bottom:0;left:0;overflow:hidden}.file_viewer.svelte-in5te4>.file_viewer_headerbar.svelte-in5te4.svelte-in5te4{flex-grow:0;flex-shrink:0;display:flex;flex-direction:row;text-align:left;z-index:10;box-shadow:none;padding:4px}.file_viewer.svelte-in5te4>.file_viewer_headerbar.svelte-in5te4>.svelte-in5te4{flex-grow:0;flex-shrink:0;margin-left:4px;margin-right:4px;display:inline;align-self:center}.file_viewer.svelte-in5te4>.file_viewer_headerbar.svelte-in5te4>.file_viewer_headerbar_title.svelte-in5te4{flex-grow:1;flex-shrink:1;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;flex-direction:row}.breadcrumb.svelte-in5te4.svelte-in5te4.svelte-in5te4{border-radius:1em;min-width:1em;text-align:center;line-height:1.2em;padding:3px 8px;margin:2px 6px;word-break:break-all}.breadcrumb_button.svelte-in5te4.svelte-in5te4.svelte-in5te4{cursor:pointer;background-color:var(--layer_2_color);transition:0.2s background-color, 0.2s color}.breadcrumb_button.svelte-in5te4.svelte-in5te4.svelte-in5te4:hover,.breadcrumb_button.svelte-in5te4.svelte-in5te4.svelte-in5te4:focus,.breadcrumb_button.svelte-in5te4.svelte-in5te4.svelte-in5te4:active{color:var(--input_text_color);background-color:var(--input_color)}.breadcrumb_last.svelte-in5te4.svelte-in5te4.svelte-in5te4{color:var(--highlight_text_color);background-color:var(--highlight_color)}.button_home.svelte-in5te4.svelte-in5te4.svelte-in5te4::after{content:"pixeldrain"}@media(max-width: 600px){.button_home.svelte-in5te4.svelte-in5te4.svelte-in5te4::after{content:"pd"}}.file_viewer.svelte-in5te4>.list_navigator.svelte-in5te4.svelte-in5te4{flex-grow:0;flex-shrink:0;position:relative;display:none;width:100%;background-color:var(--layer_1_color);text-align:center;line-height:1em;overflow-x:auto;overflow-y:hidden;z-index:50;white-space:nowrap}.file_viewer.svelte-in5te4>.file_viewer_window.svelte-in5te4.svelte-in5te4{flex-grow:1;flex-shrink:1;position:relative;display:inline-block;width:auto;height:auto;margin:0;z-index:9}.file_viewer.svelte-in5te4>.file_viewer_window.svelte-in5te4>.file_viewer_file_preview.svelte-in5te4{position:absolute;left:0;right:0;top:0;bottom:0;display:inline-block;min-height:100px;min-width:100px;text-align:center;vertical-align:middle;transition:left 0.5s;overflow:hidden;box-shadow:inset 2px 2px 8px var(--shadow_color)}.toolbar.svelte-in5te4.svelte-in5te4.svelte-in5te4{position:absolute;width:8em;z-index:49;overflow:hidden;float:left;background-color:var(--layer_1_color);left:-8em;bottom:0;top:0;padding:0;text-align:left;transition:left 0.5s}.toolbar.toolbar_visible.svelte-in5te4.svelte-in5te4.svelte-in5te4{left:0}.file_viewer.svelte-in5te4>.file_viewer_window.svelte-in5te4>.file_viewer_file_preview.toolbar_visible.svelte-in5te4{left:8em}.toolbar.svelte-in5te4>div.svelte-in5te4.svelte-in5te4{position:absolute;left:0;top:0;bottom:0;right:-30px;overflow-y:scroll;overflow-x:hidden}.toolbar.svelte-in5te4>div.svelte-in5te4>div.svelte-in5te4{position:absolute;left:0;top:0;width:8em;height:auto;text-align:center}.toolbar_button.svelte-in5te4.svelte-in5te4.svelte-in5te4{text-align:left}.toolbar_label.svelte-in5te4.svelte-in5te4.svelte-in5te4{text-align:left;padding-left:10px;font-size:0.8em;line-height:0.7em;margin-top:0.5em}.toolbar_statistic.svelte-in5te4.svelte-in5te4.svelte-in5te4{text-align:center}
.sharebar.svelte-gnq1s2{position:absolute;width:7em;left:-8em;bottom:0;top:0;overflow-y:scroll;overflow-x:hidden;float:left;background-color:var(--layer_1_color);box-shadow:inset 1px 1px var(--layer_1_shadow) var(--shadow_color);text-align:center;z-index:48;overflow:hidden;transition:left 0.5s}.visible.svelte-gnq1s2{left:8em}
.hidden.svelte-1bqdpyt.svelte-1bqdpyt.svelte-1bqdpyt{visibility:hidden}.container.svelte-1bqdpyt.svelte-1bqdpyt.svelte-1bqdpyt{height:100%;width:100%;padding:0;overflow-y:auto;text-align:center}.width_container.svelte-1bqdpyt.svelte-1bqdpyt.svelte-1bqdpyt{position:relative;display:inline-block;max-width:94%;width:1000px;margin:0;padding:0}.toolbar.svelte-1bqdpyt.svelte-1bqdpyt.svelte-1bqdpyt{position:relative;display:inline-flex;flex-direction:row;width:100%;margin:16px 0 0 0;padding:0;box-sizing:border-box;justify-content:center}.toolbar.svelte-1bqdpyt>.svelte-1bqdpyt.svelte-1bqdpyt{flex:0 0 auto}.toolbar_spacer.svelte-1bqdpyt.svelte-1bqdpyt.svelte-1bqdpyt{flex:1 1 auto}@media(max-width: 800px){.toolbar_delete.svelte-1bqdpyt.svelte-1bqdpyt.svelte-1bqdpyt{flex-direction:column}}.directory.svelte-1bqdpyt.svelte-1bqdpyt.svelte-1bqdpyt{display:table;position:relative;overflow-x:auto;overflow-y:hidden;width:100%;margin:16px 0 16px 0;text-align:left;background-color:var(--layer_2_color);box-shadow:1px 1px var(--layer_2_shadow) var(--shadow_color);box-sizing:border-box;border-collapse:collapse}.directory.svelte-1bqdpyt>.svelte-1bqdpyt.svelte-1bqdpyt{display:table-row}.directory.svelte-1bqdpyt>.svelte-1bqdpyt>.svelte-1bqdpyt{display:table-cell}.directory.svelte-1bqdpyt .node{display:table-row;text-decoration:none;color:var(--text-color);padding:6px;box-sizing:border-box}.directory.svelte-1bqdpyt .node:not(:last-child){border-bottom:1px solid var(--layer_3_color)}.directory.svelte-1bqdpyt .node:hover:not(.node_selected){background-color:var(--input_color_dark);color:var(--input_text_color);text-decoration:none}.directory.svelte-1bqdpyt .node.node_selected{background-color:var(--highlight_color) !important;color:var(--highlight_text_color)}.directory.svelte-1bqdpyt .node.node_delete{background-color:var(--danger_color) !important;color:var(--highlight_text_color)}.directory.svelte-1bqdpyt td{padding:4px;vertical-align:middle}.directory.svelte-1bqdpyt .node_icon{height:32px;width:auto;vertical-align:middle}.directory.svelte-1bqdpyt .node_name{width:100%;overflow:hidden;line-height:1.2em;word-break:break-all}.directory.svelte-1bqdpyt .node_size{min-width:50px;white-space:nowrap}
.hidden.svelte-2zhofy{display:none}.file_input.svelte-2zhofy{display:block;visibility:hidden;width:0;height:0}.file_upload.svelte-2zhofy{display:block;text-align:left;width:100%;margin:6px 0 0 0;padding:0;background-color:var(--layer_2_color);box-shadow:1px 1px var(--layer_2_shadow) var(--shadow_color)}.upload_progress_bar.svelte-2zhofy{width:100%;height:2px}.upload_progress.svelte-2zhofy{background-color:var(--highlight_color);height:100%}
.hidden.svelte-1342op5{display:none}.file_upload.svelte-1342op5{display:inline-block;width:100%;background-color:var(--layer_2_color)}.file_upload.file_upload_active.svelte-1342op5{background-color:var(--highlight_color)}
.container.svelte-11r8rw7{height:100%;width:100%;margin:50px 0 0 0;padding:0;overflow-y:auto;text-align:center}.player.svelte-11r8rw7{width:90%}
.container.svelte-xjzx7h{position:relative;display:block;height:100%;width:100%;text-align:center;overflow:hidden}.container.zoom.svelte-xjzx7h{overflow:auto}.image.svelte-xjzx7h{position:relative;display:block;margin:auto;max-width:100%;max-height:100%;top:50%;cursor:pointer;transform:translateY(-50%);box-shadow:1px 1px var(--layer_3_shadow) var(--shadow_color)}.image.zoom.svelte-xjzx7h{max-width:none;max-height:none;top:0;cursor:move;transform:none}
.container.svelte-1iaovvu{position:relative;display:block;height:100%;width:100%;text-align:center;overflow:hidden}.player.svelte-1iaovvu{position:relative;display:block;margin:auto;max-width:100%;max-height:100%;top:50%;transform:translateY(-50%);box-shadow:1px 1px var(--layer_3_shadow) var(--shadow_color)}
.background.svelte-tirhyp{position:fixed;text-align:center;top:0;right:0;bottom:0;left:0;background-color:rgba(0, 0, 0, 0.5)}.window.svelte-tirhyp{position:absolute;z-index:inherit;display:flex;flex-direction:column;background-color:var(--layer_2_color);max-height:100%;max-width:100%;margin:0 auto;top:20%;left:50%;transform:translate(-50%, -20%);padding:0;box-sizing:border-box;text-align:left;box-shadow:var(--shadow_color) 0px 0px 50px}.header.svelte-tirhyp{flex-grow:0;flex-shrink:0;display:flex;flex-direction:row;padding:1px}.title.svelte-tirhyp{flex-grow:1;flex-shrink:1;display:flex;flex-direction:row;align-items:center;justify-content:center;font-size:1.2em;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.button_close.svelte-tirhyp{flex-grow:0;flex-shrink:0}.body.svelte-tirhyp{flex-grow:1;flex-shrink:1;overflow:auto;padding:10px}
svg.svelte-1pco739{color:var(--highlight_color);fill:currentColor}
/*# sourceMappingURL=filesystem.css.map */

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +0,0 @@
.background.svelte-tirhyp{position:fixed;text-align:center;top:0;right:0;bottom:0;left:0;background-color:rgba(0, 0, 0, 0.5)}.window.svelte-tirhyp{position:absolute;z-index:inherit;display:flex;flex-direction:column;background-color:var(--layer_2_color);max-height:100%;max-width:100%;margin:0 auto;top:20%;left:50%;transform:translate(-50%, -20%);padding:0;box-sizing:border-box;text-align:left;box-shadow:var(--shadow_color) 0px 0px 50px}.header.svelte-tirhyp{flex-grow:0;flex-shrink:0;display:flex;flex-direction:row;padding:1px}.title.svelte-tirhyp{flex-grow:1;flex-shrink:1;display:flex;flex-direction:row;align-items:center;justify-content:center;font-size:1.2em;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.button_close.svelte-tirhyp{flex-grow:0;flex-shrink:0}.body.svelte-tirhyp{flex-grow:1;flex-shrink:1;overflow:auto;padding:10px}
/*# sourceMappingURL=modal.css.map */

File diff suppressed because it is too large Load Diff

View File

@@ -156,9 +156,6 @@
<a class="sponsors_banner" style="display: inline-block; width: 576px; height: 96px;" href="/click/DtZ3hHT9?target=https%3A%2F%2Fwww.amarulasolutions.com/jobs"> <a class="sponsors_banner" style="display: inline-block; width: 576px; height: 96px;" href="/click/DtZ3hHT9?target=https%3A%2F%2Fwww.amarulasolutions.com/jobs">
<img src="/res/img/misc/banner_amarula_jobs.png" style="width: 100%; height: 100%" /> <img src="/res/img/misc/banner_amarula_jobs.png" style="width: 100%; height: 100%" />
</a> </a>
{{ else if eq .Other.AdType 7}}
<!-- Revenuehits -->
<iframe class="sponsors_banner" src="/ad/revenuehits" style="width:728px; height:90px; border:none; padding:0; overflow:hidden;" scrolling="no"></iframe>
{{ else if eq .Other.AdType 8}} {{ else if eq .Other.AdType 8}}
<!-- Brave --> <!-- Brave -->
<a class="sponsors_banner" style="display: inline-block; width: 728px; height: 90px;" href="https://brave.com/pix009"> <a class="sponsors_banner" style="display: inline-block; width: 728px; height: 90px;" href="https://brave.com/pix009">
@@ -270,6 +267,14 @@
{{ if eq .Other.AdType 5 }} {{ if eq .Other.AdType 5 }}
<!-- AdMaven --> <!-- AdMaven -->
<script data-cfasync="false" async src="//d227cncaprzd7y.cloudfront.net/?acncd=905608"></script> <script data-cfasync="false" async src="//d227cncaprzd7y.cloudfront.net/?acncd=905608"></script>
{{ else if eq .Other.AdType 7}}
<!-- PropellerAds -->
<script>
(function(d,z,s){
s.src='//'+d+'/400/'+z
try{(document.body||document.documentElement).appendChild(s)}catch(e){}
})('in-page-push.com',3724132,document.createElement('script'))
</script>
{{ end }} {{ end }}
{{ end }} {{ end }}
</body> </body>

View File

@@ -1,6 +1,6 @@
<script> <script>
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { formatDate, formatDataVolume, formatThousands, formatNumber } from '../util/Formatting.svelte' import { formatDate, formatDataVolume, formatThousands } from '../util/Formatting.svelte'
import { fs_get_file_url, fs_get_node } from './FilesystemAPI.svelte' import { fs_get_file_url, fs_get_node } from './FilesystemAPI.svelte'
import Sharebar from './Sharebar.svelte' import Sharebar from './Sharebar.svelte'
import Spinner from '../util/Spinner.svelte' import Spinner from '../util/Spinner.svelte'
@@ -9,13 +9,12 @@ import FileManager from './filemanager/FileManager.svelte';
import Audio from './viewers/Audio.svelte'; import Audio from './viewers/Audio.svelte';
import Image from './viewers/Image.svelte'; import Image from './viewers/Image.svelte';
import Video from './viewers/Video.svelte'; import Video from './viewers/Video.svelte';
import { current_component } from 'svelte/internal';
// Elements // Elements
let file_viewer let file_viewer
let header_bar let header_bar
let toolbar_visible = (window.innerWidth > 800) let toolbar_visible = (window.innerWidth > 600)
let toolbar_toggle = () => { let toolbar_toggle = () => {
toolbar_visible = !toolbar_visible toolbar_visible = !toolbar_visible
if (!toolbar_visible) { if (!toolbar_visible) {
@@ -38,7 +37,10 @@ let state = {
// When navigating into a file or directory the siblings array will be // When navigating into a file or directory the siblings array will be
// populated with the previous base's children // populated with the previous base's children
siblings: [], siblings: [],
current_sibling: -1,
// Root path of the bucket. Used for navigation by prepending it to a file
// path
path_root: "/d/"+initialNode.bucket.id, path_root: "/d/"+initialNode.bucket.id,
loading: true, loading: true,
viewer_type: "" viewer_type: ""
@@ -85,6 +87,23 @@ const openNode = (node) => {
// Sort directory children // Sort directory children
sort_children(node.base.children) sort_children(node.base.children)
// If the new node is a child of the previous node we save the parent's
// children array
if (node.parents.length > 0 && node.parents[node.parents.length-1].path === state.base.path) {
console.debug("Current parent path and new node path match. Saving siblings")
state.siblings = state.base.children
state.current_sibling = -1
// Find which sibling is currently open
for (let i = 0; i < state.siblings.length; i++) {
if (state.siblings[i].name === node.base.name) {
state.current_sibling = i
console.debug("Current sibling ID is", i)
break
}
}
}
// Update shared state // Update shared state
state.bucket = node.bucket state.bucket = node.bucket
state.parents = node.parents state.parents = node.parents
@@ -167,11 +186,13 @@ window.onpopstate = (e) => {
const keydown = e => { const keydown = e => {
switch (e.key) { switch (e.key) {
case 'Escape': case "Escape":
hide(); hide();
return; return;
case 'i': case "i":
details_window.toggle() details_window.toggle()
case "s":
download()
} }
}; };
@@ -197,7 +218,12 @@ const download = () => {
<a href="/" id="button_home" class="button button_home"><i class="icon">home</i></a> <a href="/" id="button_home" class="button button_home"><i class="icon">home</i></a>
<div class="file_viewer_headerbar_title"> <div class="file_viewer_headerbar_title">
{#each state.parents as parent} {#each state.parents as parent}
<div class="breadcrumb breadcrumb_button" on:click={() => {navigate(parent.path, true)}}>{parent.name}</div> / <a
href={state.path_root+parent.path}
class="breadcrumb breadcrumb_button"
on:click|preventDefault={() => {navigate(parent.path, true)}}>
{parent.name}
</a> /
{/each} {/each}
<div class="breadcrumb breadcrumb_last">{state.base.name}</div> <div class="breadcrumb breadcrumb_last">{state.base.name}</div>
</div> </div>
@@ -331,6 +357,8 @@ const download = () => {
} }
.breadcrumb_button { .breadcrumb_button {
cursor: pointer; cursor: pointer;
text-decoration: none;
color: var(--text_color);
background-color: var(--layer_2_color); background-color: var(--layer_2_color);
transition: 0.2s background-color, 0.2s color; transition: 0.2s background-color, 0.2s color;
} }

View File

@@ -1,36 +1,34 @@
<script context="module"> <script context="module">
export const fs_create_directory = (bucket, path, dir_name) => { export const fs_create_directory = async (bucket, path, dir_name) => {
if (!path.startsWith("/")) { if (!path.startsWith("/")) {
path = "/" + path path = "/" + path
} }
let form = new FormData() const form = new FormData()
form.append("type", "dir") form.append("type", "dir")
return fetch( const resp=await fetch(
window.api_endpoint + "/filesystem/" + bucket + encodeURIComponent(path + "/" + dir_name), window.api_endpoint+"/filesystem/"+bucket+encodeURIComponent(path+"/"+dir_name),
{method: "POST", body: form}, { method: "POST", body: form }
).then(resp => { );
if (resp.status >= 400) { if(resp.status >= 400) {
throw new Error(resp.text()) throw new Error(resp.text());
} }
})
} }
export const fs_get_node = (bucket, path) => { export const fs_get_node = async (bucket, path) => {
if (!path.startsWith("/")) { if (!path.startsWith("/")) {
path = "/" + path path = "/" + path
} }
return fetch( const resp = await fetch(
window.api_endpoint + "/filesystem/" + bucket + encodeURIComponent(path) + "?stat", window.api_endpoint+"/filesystem/"+bucket+encodeURIComponent(path)+"?stat"
).then(resp => { );
if (resp.status >= 400) { if(resp.status >= 400) {
throw new Error(resp.text()) throw new Error(resp.text());
} }
return resp.json() return resp.json();
})
} }
export const fs_get_file_url = (bucket, path) => { export const fs_get_file_url = (bucket, path) => {
@@ -40,19 +38,18 @@ export const fs_get_file_url = (bucket, path) => {
return window.api_endpoint + "/filesystem/" + bucket + encodeURIComponent(path) return window.api_endpoint + "/filesystem/" + bucket + encodeURIComponent(path)
} }
export const fs_delete_node = (bucket, path) => { export const fs_delete_node = async (bucket, path) => {
if (!path.startsWith("/")) { if (!path.startsWith("/")) {
path = "/" + path path = "/" + path
} }
return fetch( const resp = await fetch(
window.api_endpoint + "/filesystem/" + bucket + encodeURIComponent(path), window.api_endpoint+"/filesystem/"+bucket+encodeURIComponent(path),
{method: "DELETE"}, { method: "DELETE" }
).then(resp => { );
if (resp.status >= 400) { if(resp.status >= 400) {
throw new Error(resp.text()) throw new Error(resp.text());
} }
})
} }
</script> </script>

View File

@@ -37,7 +37,7 @@ func adType() int {
soulStudio = 3 soulStudio = 3
amarulaSolutions = 4 amarulaSolutions = 4
adMaven = 5 adMaven = 5
revenueHits = 7 propellerAds = 7
brave = 8 brave = 8
) )
@@ -50,7 +50,7 @@ func adType() int {
case 4, 5: case 4, 5:
return adMaven return adMaven
case 6, 7: case 6, 7:
return patreon return propellerAds
default: default:
panic(fmt.Errorf( panic(fmt.Errorf(
"random number generator returned unrecognised number: %d", i), "random number generator returned unrecognised number: %d", i),