diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 4347e36..a560330 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -12,7 +12,7 @@
},
{
"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": {
"kind": "build",
"isDefault": true
diff --git a/README.md b/README.md
index 4e8f2db..f046016 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,7 @@ TOKEN=KILL-YOURSELF.NOW
- [X] 1.2.3 bugfixes
- [ ] 1.3.0 new ui; accounts
- [ ] 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.4.0 admin panel
- [ ] 2.0.0 rewrite using theUnfunny's code as a base/rewrite using monofile-core
diff --git a/package.json b/package.json
index 70aee39..39bc237 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "Discord-based file sharing",
"main": "index.js",
"scripts": {
- "start": "node ./out/index.js",
+ "start": "node ./out/server/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
diff --git a/pages/base.html b/pages/base.html
deleted file mode 100644
index 36ddfcc..0000000
--- a/pages/base.html
+++ /dev/null
@@ -1,173 +0,0 @@
-
-
-
-
-
-
- monofile
-
-
-
-
-
-
-
-
-
-
-
- monofile $Version
-
-
Discord-based file sharing
-
- Before sharing files, please remember:
-
- Do NOT share sensitive information via monofile
- Do NOT share illegal content via monofile
- The owner of this instance reserves the right to remove your files
-
-
-
-
- $UploadButtonText
- • • •
-
-
-
-
-
- Max filesize on instance: $MaxInstanceFilesize
-
- Hosting $FileNum files
-
-
made by nbitzz — github — $otherText
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/index.html b/pages/index.html
new file mode 100644
index 0000000..13776d6
--- /dev/null
+++ b/pages/index.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ monofile
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/rollup.config.mjs b/rollup.config.mjs
index cf4321a..42a94b2 100644
--- a/rollup.config.mjs
+++ b/rollup.config.mjs
@@ -2,9 +2,9 @@ import svelte from 'rollup-plugin-svelte'
import resolve from "@rollup/plugin-node-resolve"
export default {
- input: "src/script/client/main.js",
+ input: "src/client/main.js",
output: {
- file: 'out/script/client/bundle.js',
+ file: 'out/client/bundle.js',
format: 'esm',
sourcemap:true
},
diff --git a/src/client/main.js b/src/client/main.js
index e69de29..8bde8f1 100644
--- a/src/client/main.js
+++ b/src/client/main.js
@@ -0,0 +1,5 @@
+import App from "../svelte/App.svelte"
+
+new App({
+ target: document.body
+})
\ No newline at end of file
diff --git a/src/server/index.ts b/src/server/index.ts
index bbdc8d1..6712fc7 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -18,7 +18,10 @@ let pkg = require(`${process.cwd()}/package.json`)
let app = express()
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"]}))
// funcs
@@ -42,35 +45,7 @@ let files = new Files(client,config)
// index, clone
app.get("/", 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,"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())
- )
- })
+ res.sendFile(process.cwd()+"/pages/index.html")
})
// upload handlers
@@ -140,7 +115,7 @@ app.get("/download/:fileId",(req,res) => {
)
})
} 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) => {
- ServeError(res,404,"Page not found.")
+ ServeError(res,404,"page not found")
})
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
diff --git a/src/style/app.scss b/src/style/app.scss
new file mode 100644
index 0000000..938ccdc
--- /dev/null
+++ b/src/style/app.scss
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/src/svelte/App.svelte b/src/svelte/App.svelte
index e69de29..1aa838c 100644
--- a/src/svelte/App.svelte
+++ b/src/svelte/App.svelte
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/svelte/elem/Topbar.svelte b/src/svelte/elem/Topbar.svelte
index a1cc592..f80f1ba 100644
--- a/src/svelte/elem/Topbar.svelte
+++ b/src/svelte/elem/Topbar.svelte
@@ -1,10 +1,10 @@
-
{}} class="menuBtn">my account
{}} class="menuBtn">files
+
{}} class="menuBtn">account
diff --git a/tsconfig.json b/tsconfig.json
index 3875e14..ad71980 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -50,7 +50,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not 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. */
- "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. */
// "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. */