mirror of
https://github.com/mollersuite/monofile.git
synced 2025-02-17 15:45:55 -08:00
hhhhhhhhhh i go lseep now bye
This commit is contained in:
parent
c911896f6d
commit
9e5fbd3082
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command":"tsc\nsass src/style:out/style\nrollup -c\nnpx tsc\nnode ./out/index.js\ndel ./out/* -Recurse",
|
"command":"tsc\nsass src/style:out/style\nrollup -c\nnode ./out/server/index.js\ndel ./out/* -Recurse",
|
||||||
"group": {
|
"group": {
|
||||||
"kind": "build",
|
"kind": "build",
|
||||||
"isDefault": true
|
"isDefault": true
|
||||||
|
|
|
@ -23,6 +23,7 @@ TOKEN=KILL-YOURSELF.NOW
|
||||||
- [X] 1.2.3 bugfixes
|
- [X] 1.2.3 bugfixes
|
||||||
- [ ] 1.3.0 new ui; accounts
|
- [ ] 1.3.0 new ui; accounts
|
||||||
- [ ] 1.3.1 add utility endpoints: `/embed/:fileId` for discord, `/:fileId` for quick access
|
- [ ] 1.3.1 add utility endpoints: `/embed/:fileId` for discord, `/:fileId` for quick access
|
||||||
|
- [ ] 1.3.2 support multiple uploads
|
||||||
- [ ] 1.3.3 disable cloning of local ips
|
- [ ] 1.3.3 disable cloning of local ips
|
||||||
- [ ] 1.4.0 admin panel
|
- [ ] 1.4.0 admin panel
|
||||||
- [ ] 2.0.0 rewrite using theUnfunny's code as a base/rewrite using monofile-core
|
- [ ] 2.0.0 rewrite using theUnfunny's code as a base/rewrite using monofile-core
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "Discord-based file sharing",
|
"description": "Discord-based file sharing",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./out/index.js",
|
"start": "node ./out/server/index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|
173
pages/base.html
173
pages/base.html
|
@ -1,173 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>monofile</title>
|
|
||||||
|
|
||||||
<meta name="og:site_name" content="$Version">
|
|
||||||
<meta name="application-name" content="monofile">
|
|
||||||
<meta name="description" content="Discord-based filesharing">
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
* {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
h1,h2 {
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
#content {
|
|
||||||
position:fixed;
|
|
||||||
left:50%;
|
|
||||||
top:50%;
|
|
||||||
transform:translate(-50%,-50%);
|
|
||||||
background-color:white;
|
|
||||||
width:450px;
|
|
||||||
/*height:100%;*/
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
background-color: darkgray;
|
|
||||||
}
|
|
||||||
#btnContainer {
|
|
||||||
width:calc( 100% - 50px );
|
|
||||||
height:50px;
|
|
||||||
position:relative;
|
|
||||||
left:50%;
|
|
||||||
transform:translate(-50%,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
color:black;
|
|
||||||
font-weight:bold;
|
|
||||||
border:none;
|
|
||||||
position:absolute;
|
|
||||||
font-size:20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
border: 1px solid gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
#uploadButton {
|
|
||||||
width:calc( 100% - 50px );
|
|
||||||
height:100%;
|
|
||||||
background-color: #66AAFF;
|
|
||||||
left:0px;
|
|
||||||
top:0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#optionsButton {
|
|
||||||
width:50px;
|
|
||||||
height:100%;
|
|
||||||
background-color: #AAAAAA;
|
|
||||||
left:calc( 100% - 50px );
|
|
||||||
top:0px;
|
|
||||||
font-size:15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note {
|
|
||||||
padding:5px;
|
|
||||||
position:relative;
|
|
||||||
width:calc( 100% - 62px );
|
|
||||||
left:25px;
|
|
||||||
border:1px solid #AAAAAAFF;
|
|
||||||
border-radius: 8px;
|
|
||||||
background-color: #AAAAAA66;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this is horrible css lmao */
|
|
||||||
|
|
||||||
#options > input {
|
|
||||||
font-family:monospace;
|
|
||||||
width:250px;
|
|
||||||
font-size:14px;
|
|
||||||
border: 1px solid #777777;
|
|
||||||
background-color:#AAAAAA;
|
|
||||||
outline:none;
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#options {
|
|
||||||
height:30px;
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#customId {
|
|
||||||
position:absolute;
|
|
||||||
left:50%;
|
|
||||||
top:50%;
|
|
||||||
transform:translate(-50%,-50%)
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-width: 450px) {
|
|
||||||
#content {
|
|
||||||
position:fixed;
|
|
||||||
left:0%;
|
|
||||||
top:0%;
|
|
||||||
transform:translate(0%,0%);
|
|
||||||
background-color:white;
|
|
||||||
width:100%;
|
|
||||||
height:100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<input type="text" id="CopyTB" value="" readonly style="opacity:0;width:10px;height:0%;">
|
|
||||||
<div id="content">
|
|
||||||
<h1>
|
|
||||||
monofile<span style="font-style:italic;font-weight:bold;font-size:16px;color:#999999"> $Version</span>
|
|
||||||
</h1>
|
|
||||||
<h2><em>Discord-based file sharing</em></h2>
|
|
||||||
<div class="note" style="border-color:#FFAAAAFF;background-color:#FFAAAA66">
|
|
||||||
Before sharing files, please remember:
|
|
||||||
<ul>
|
|
||||||
<li>Do NOT share sensitive information via monofile</li>
|
|
||||||
<li>Do NOT share illegal content via monofile</li>
|
|
||||||
<li>The owner of this instance reserves the right to remove your files</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div style="width:100%;height:25px"></div>
|
|
||||||
<div id="btnContainer">
|
|
||||||
<button id="uploadButton">$UploadButtonText</button>
|
|
||||||
<button id="optionsButton">• • •</button>
|
|
||||||
</div>
|
|
||||||
<div id="options" class="note" style="border-radius:0px;">
|
|
||||||
<input id="customId" autocomplete="off" placeholder = "custom id (30char, no spaces)" maxlength="30">
|
|
||||||
</div>
|
|
||||||
<p style="font-family:monospace;position:relative;width:calc( 100% - 50px );left:25px;text-align: center;">
|
|
||||||
Max filesize on instance: $MaxInstanceFilesize
|
|
||||||
<br />
|
|
||||||
Hosting <strong style="font-family:monospace">$FileNum</strong> files
|
|
||||||
</p>
|
|
||||||
<p style="font-family:monospace;position:relative;width:calc( 100% - 50px );left:25px;text-align: center;font-size:12px;color:gray;">made by nbitzz — <a style="color:gray;font-family:monospace;font-size:12px;" href="https://github.com/nbitzz/monofile">github</a> — <a style="color:gray;font-family:monospace;font-size:12px;" href="$otherPath">$otherText</a></p>
|
|
||||||
<div style="width:100%;height:25px"></div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
<!-- bad thing to do but i'm being rushed -->
|
|
||||||
|
|
||||||
<script>
|
|
||||||
let uploading = false
|
|
||||||
const updateBtnTxt = (btntxt) => {document.getElementById("btnContainer").innerHTML = `<div class="note" style="width:calc( 100% - 10px );height:calc( 100% - 10px );position:absolute;left:0px;top:0px;"><p style="font-family:monospace;position:relative;width:calc( 100% - 50px );left:25px;text-align: center;">${btntxt}</p></div>`}
|
|
||||||
const getOptionsForUploading = () => {
|
|
||||||
uploading = true
|
|
||||||
document.getElementById("options").style.display = "none"
|
|
||||||
|
|
||||||
return {
|
|
||||||
uploadId: document.getElementById("customId").value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById("optionsButton").addEventListener("click",() => {
|
|
||||||
let display = document.getElementById("options").style.display
|
|
||||||
if (!uploading) document.getElementById("options").style.display = !display || display == "none" ? "block" : "none"
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="/static/script/$Handler.js"></script>
|
|
||||||
|
|
||||||
</html>
|
|
31
pages/index.html
Normal file
31
pages/index.html
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="/static/style/app.css"
|
||||||
|
>
|
||||||
|
|
||||||
|
<link
|
||||||
|
rel="icon"
|
||||||
|
type="image/png"
|
||||||
|
href="/static/assets/monofile-circ.png"
|
||||||
|
>
|
||||||
|
|
||||||
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, user-scalable=0"
|
||||||
|
>
|
||||||
|
|
||||||
|
<script type="module" src="/static/js/bundle.js"></script>
|
||||||
|
|
||||||
|
<title>monofile</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -2,9 +2,9 @@ import svelte from 'rollup-plugin-svelte'
|
||||||
import resolve from "@rollup/plugin-node-resolve"
|
import resolve from "@rollup/plugin-node-resolve"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: "src/script/client/main.js",
|
input: "src/client/main.js",
|
||||||
output: {
|
output: {
|
||||||
file: 'out/script/client/bundle.js',
|
file: 'out/client/bundle.js',
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
sourcemap:true
|
sourcemap:true
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import App from "../svelte/App.svelte"
|
||||||
|
|
||||||
|
new App({
|
||||||
|
target: document.body
|
||||||
|
})
|
|
@ -18,7 +18,10 @@ let pkg = require(`${process.cwd()}/package.json`)
|
||||||
let app = express()
|
let app = express()
|
||||||
let config = require(`${process.cwd()}/config.json`)
|
let config = require(`${process.cwd()}/config.json`)
|
||||||
|
|
||||||
app.use("/static",express.static("assets"))
|
app.use("/static/assets",express.static("assets"))
|
||||||
|
app.use("/static/style",express.static("out/style"))
|
||||||
|
app.use("/static/js",express.static("out/client"))
|
||||||
|
|
||||||
app.use(bodyParser.text({limit:(config.maxDiscordFileSize*config.maxDiscordFiles)+1048576,type:["application/json","text/plain"]}))
|
app.use(bodyParser.text({limit:(config.maxDiscordFileSize*config.maxDiscordFiles)+1048576,type:["application/json","text/plain"]}))
|
||||||
// funcs
|
// funcs
|
||||||
|
|
||||||
|
@ -42,35 +45,7 @@ let files = new Files(client,config)
|
||||||
// index, clone
|
// index, clone
|
||||||
|
|
||||||
app.get("/", function(req,res) {
|
app.get("/", function(req,res) {
|
||||||
fs.readFile(__dirname+"/../pages/base.html",(err,buf) => {
|
res.sendFile(process.cwd()+"/pages/index.html")
|
||||||
if (err) {res.sendStatus(500);console.log(err);return}
|
|
||||||
res.send(
|
|
||||||
buf.toString()
|
|
||||||
.replace("$MaxInstanceFilesize",`${(config.maxDiscordFileSize*config.maxDiscordFiles)/1048576}MB`)
|
|
||||||
.replace(/\$Version/g,pkg.version)
|
|
||||||
.replace(/\$Handler/g,"upload_file")
|
|
||||||
.replace(/\$UploadButtonText/g,"Upload file")
|
|
||||||
.replace(/\$otherPath/g,"/clone")
|
|
||||||
.replace(/\$otherText/g,"clone from url...")
|
|
||||||
.replace(/\$FileNum/g,Object.keys(files.files).length.toString())
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get("/clone", function(req,res) {
|
|
||||||
fs.readFile(__dirname+"/../pages/base.html",(err,buf) => {
|
|
||||||
if (err) {res.sendStatus(500);console.log(err);return}
|
|
||||||
res.send(
|
|
||||||
buf.toString()
|
|
||||||
.replace("$MaxInstanceFilesize",`${(config.maxDiscordFileSize*config.maxDiscordFiles)/1048576}MB`)
|
|
||||||
.replace(/\$Version/g,pkg.version)
|
|
||||||
.replace(/\$Handler/g,"clone_file")
|
|
||||||
.replace(/\$UploadButtonText/g,"Input a URL")
|
|
||||||
.replace(/\$otherPath/g,"/")
|
|
||||||
.replace(/\$otherText/g,"upload file...")
|
|
||||||
.replace(/\$FileNum/g,Object.keys(files.files).length.toString())
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// upload handlers
|
// upload handlers
|
||||||
|
@ -140,7 +115,7 @@ app.get("/download/:fileId",(req,res) => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ServeError(res,404,"File not found.")
|
ServeError(res,404,"file not found")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -155,11 +130,15 @@ app.get("/file/:fileId",async (req,res) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get("*",(req,res) => {
|
app.get("*",(req,res) => {
|
||||||
ServeError(res,404,"Page not found.")
|
ServeError(res,404,"page not found")
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get("/server",(req,res) => {
|
app.get("/server",(req,res) => {
|
||||||
res.send(JSON.stringify({...config,version:pkg.version}))
|
res.send(JSON.stringify({
|
||||||
|
...config,
|
||||||
|
version:pkg.version,
|
||||||
|
files:files.files.length
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
// listen on 3000 or MONOFILE_PORT
|
// listen on 3000 or MONOFILE_PORT
|
||||||
|
|
22
src/style/app.scss
Normal file
22
src/style/app.scss
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
@use "base";
|
||||||
|
@use "app/topbar";
|
||||||
|
|
||||||
|
.menuBtn {
|
||||||
|
text-decoration:none;
|
||||||
|
font-size:16px;
|
||||||
|
transition-duration: 100ms;
|
||||||
|
|
||||||
|
color:#555555;
|
||||||
|
background-color: #00000000;
|
||||||
|
border:none;
|
||||||
|
margin:0 0 0 0;
|
||||||
|
cursor:pointer;
|
||||||
|
|
||||||
|
position:relative;
|
||||||
|
top:-1px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color:slategray;
|
||||||
|
transition-duration: 100ms;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!--
|
||||||
|
I know this code is pretty bad,
|
||||||
|
but this is my first time using svelte lol
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import Topbar from "./elem/Topbar.svelte";
|
||||||
|
/**
|
||||||
|
* @type Topbar
|
||||||
|
*/
|
||||||
|
let topbar;
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Topbar bind:this={topbar} />
|
||||||
|
<div id="appContent">
|
||||||
|
|
||||||
|
</div>
|
|
@ -3,8 +3,8 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="topbar">
|
<div id="topbar">
|
||||||
<button on:click={() => {}} class="menuBtn">my account</button>
|
|
||||||
<button on:click={() => {}} class="menuBtn">files</button>
|
<button on:click={() => {}} class="menuBtn">files</button>
|
||||||
|
<button on:click={() => {}} class="menuBtn">account</button>
|
||||||
|
|
||||||
<!-- divider -->
|
<!-- divider -->
|
||||||
<div style="height:calc( 100% - 10px ); top:5px; width:2px; background-color:#333333; margin:0 5px 0 5px;" />
|
<div style="height:calc( 100% - 10px ); top:5px; width:2px; background-color:#333333; margin:0 5px 0 5px;" />
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
"outDir": "./out/", /* Specify an output folder for all emitted files. */
|
"outDir": "./out/server", /* Specify an output folder for all emitted files. */
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
|
|
Loading…
Reference in a new issue