Increase cache duration, fix bandwidth warning
This commit is contained in:
4
go.mod
4
go.mod
@@ -5,7 +5,7 @@ go 1.17
|
|||||||
require (
|
require (
|
||||||
fornaxian.tech/config v0.0.0-20211108212237-6133aed90586
|
fornaxian.tech/config v0.0.0-20211108212237-6133aed90586
|
||||||
fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640
|
fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640
|
||||||
fornaxian.tech/pixeldrain_api_client v0.0.0-20211122200521-a6db980e487a
|
fornaxian.tech/pixeldrain_api_client v0.0.0-20211123215854-be6e25030ad8
|
||||||
fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787
|
fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787
|
||||||
github.com/julienschmidt/httprouter v1.3.0
|
github.com/julienschmidt/httprouter v1.3.0
|
||||||
github.com/microcosm-cc/bluemonday v1.0.16
|
github.com/microcosm-cc/bluemonday v1.0.16
|
||||||
@@ -20,6 +20,6 @@ require (
|
|||||||
github.com/gorilla/css v1.0.0 // indirect
|
github.com/gorilla/css v1.0.0 // indirect
|
||||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
||||||
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
|
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
|
||||||
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4 // indirect
|
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 // indirect
|
||||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||||
)
|
)
|
||||||
|
8
go.sum
8
go.sum
@@ -3,8 +3,8 @@ fornaxian.tech/config v0.0.0-20211108212237-6133aed90586/go.mod h1:ULIXF4J1DbBw4
|
|||||||
fornaxian.tech/log v0.0.0-20190617093801-1c7ce9a7c9b3/go.mod h1:OyWUNsNPlo5AmlOHvJ4s6WcStQw+9rQyBMwmTz0buEM=
|
fornaxian.tech/log v0.0.0-20190617093801-1c7ce9a7c9b3/go.mod h1:OyWUNsNPlo5AmlOHvJ4s6WcStQw+9rQyBMwmTz0buEM=
|
||||||
fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640 h1:UPDxJwLRCfh/cv80UMSanzmZ0jIcfS1mcd0Y06HYuLw=
|
fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640 h1:UPDxJwLRCfh/cv80UMSanzmZ0jIcfS1mcd0Y06HYuLw=
|
||||||
fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640/go.mod h1:sN82qMToeHhP2u3ehvrcE8y1IudRZJAZO9yG5OBYblo=
|
fornaxian.tech/log v0.0.0-20211102185326-552e9b1f8640/go.mod h1:sN82qMToeHhP2u3ehvrcE8y1IudRZJAZO9yG5OBYblo=
|
||||||
fornaxian.tech/pixeldrain_api_client v0.0.0-20211122200521-a6db980e487a h1:agn27B8aKpCd1vNYS28jQ/xjxQrp3aZzA7pA85Noi3o=
|
fornaxian.tech/pixeldrain_api_client v0.0.0-20211123215854-be6e25030ad8 h1:0ueAJb5nHOpFa5TXZgVVs4ORsf2zhpxLRUx3AuAx+wM=
|
||||||
fornaxian.tech/pixeldrain_api_client v0.0.0-20211122200521-a6db980e487a/go.mod h1:uajB2ofEsefUtxjvs4m7SDyPVRlfrI3qzCSWcud47hY=
|
fornaxian.tech/pixeldrain_api_client v0.0.0-20211123215854-be6e25030ad8/go.mod h1:uajB2ofEsefUtxjvs4m7SDyPVRlfrI3qzCSWcud47hY=
|
||||||
fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787 h1:9ujI8Qi6+FTL/YW6xQAS9DmWDMerHBe8foQvVD/G/i0=
|
fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787 h1:9ujI8Qi6+FTL/YW6xQAS9DmWDMerHBe8foQvVD/G/i0=
|
||||||
fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787/go.mod h1:FqVgfghmxTGR3l9Zx4MOMeZ9KHjiEFl3s3C0BSTvBwk=
|
fornaxian.tech/util v0.0.0-20211102152345-9a486dee9787/go.mod h1:FqVgfghmxTGR3l9Zx4MOMeZ9KHjiEFl3s3C0BSTvBwk=
|
||||||
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
|
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
|
||||||
@@ -46,8 +46,8 @@ golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0
|
|||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
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-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-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4 h1:DZshvxDdVoeKIbudAdFEKi+f70l51luSy/7b76ibTY0=
|
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 h1:0qxwC5n+ttVOINCBeRHO0nq9X7uy8SDsPoi5OaCdIEI=
|
||||||
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
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-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
@@ -439,17 +439,16 @@ const keyboard_event = evt => {
|
|||||||
|
|
||||||
<div id="file_preview_window" class="file_preview_window">
|
<div id="file_preview_window" class="file_preview_window">
|
||||||
<div id="toolbar" class="toolbar" class:toolbar_visible><div><div>
|
<div id="toolbar" class="toolbar" class:toolbar_visible><div><div>
|
||||||
|
{#if view === "file"}
|
||||||
|
<FileStats file={file}></FileStats>
|
||||||
|
<hr/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if is_list}
|
{#if is_list}
|
||||||
<button on:click={toggle_gallery} class="toolbar_button button_full_width" class:button_highlight={view === "gallery"}>
|
<button on:click={toggle_gallery} class="toolbar_button button_full_width" class:button_highlight={view === "gallery"}>
|
||||||
<i class="icon">photo_library</i>
|
<i class="icon">photo_library</i>
|
||||||
Gallery
|
Gallery
|
||||||
</button>
|
</button>
|
||||||
<hr/>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if view === "file"}
|
|
||||||
<FileStats file={file}></FileStats>
|
|
||||||
<hr/>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if file.abuse_type === "" && view === "file"}
|
{#if file.abuse_type === "" && view === "file"}
|
||||||
@@ -713,7 +712,7 @@ const keyboard_event = evt => {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
transition: left 0.5s, right 0.5s;
|
transition: left 0.5s, right 0.5s;
|
||||||
overflow: auto;
|
overflow: hidden;
|
||||||
box-shadow: inset 2px 2px 10px 2px var(--shadow_color);
|
box-shadow: inset 2px 2px 10px 2px var(--shadow_color);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
|
@@ -77,6 +77,9 @@ const delete_file = async index => {
|
|||||||
.gallery{
|
.gallery{
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.file{
|
.file{
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@@ -9,6 +9,7 @@ export let file = {
|
|||||||
name: "",
|
name: "",
|
||||||
mime_type: "",
|
mime_type: "",
|
||||||
icon_href: "",
|
icon_href: "",
|
||||||
|
show_ads: false,
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ export let file = {
|
|||||||
<i class="icon">save</i> Download
|
<i class="icon">save</i> Download
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{#if file.size > 5e8}
|
{#if file.show_ads && file.size > 5e8}
|
||||||
<br/>
|
<br/>
|
||||||
<div class="description" style="max-width: 700px; text-align: center;">
|
<div class="description" style="max-width: 700px; text-align: center;">
|
||||||
<!-- If the file is larger than 500 MB-->
|
<!-- If the file is larger than 500 MB-->
|
||||||
|
@@ -11,6 +11,7 @@ export let file = {
|
|||||||
get_href: "",
|
get_href: "",
|
||||||
icon_href: "",
|
icon_href: "",
|
||||||
allow_video_player: true,
|
allow_video_player: true,
|
||||||
|
show_ads: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
$: loop = file.name.includes(".loop.")
|
$: loop = file.name.includes(".loop.")
|
||||||
@@ -84,7 +85,7 @@ let download = () => { dispatch("download", {}) }
|
|||||||
<i class="icon">save</i> Download
|
<i class="icon">save</i> Download
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{#if file.size > 5e8}
|
{#if file.show_ads && file.size > 5e8}
|
||||||
<br/>
|
<br/>
|
||||||
<div class="description" style="max-width: 700px; text-align: center;">
|
<div class="description" style="max-width: 700px; text-align: center;">
|
||||||
<!-- If the file is larger than 500 MB-->
|
<!-- If the file is larger than 500 MB-->
|
||||||
|
@@ -79,9 +79,9 @@ func New(
|
|||||||
// Serve static files
|
// Serve static files
|
||||||
var fs = http.FileServer(http.Dir(resourceDir + "/static"))
|
var fs = http.FileServer(http.Dir(resourceDir + "/static"))
|
||||||
r.GET(prefix+"/res/*filepath", func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
r.GET(prefix+"/res/*filepath", func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||||
// Cache resources for 4 weeks
|
// Cache resources for a year
|
||||||
if !debugMode {
|
if !debugMode {
|
||||||
w.Header().Set("Cache-Control", "public, max-age=2419200")
|
w.Header().Set("Cache-Control", "public, max-age=31536000")
|
||||||
}
|
}
|
||||||
r.URL.Path = p.ByName("filepath")
|
r.URL.Path = p.ByName("filepath")
|
||||||
fs.ServeHTTP(w, r)
|
fs.ServeHTTP(w, r)
|
||||||
|
Reference in New Issue
Block a user