housekeeping
1
.github/workflows/docker-publish.yml
vendored
|
@ -91,3 +91,4 @@ jobs:
|
|||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
file: {context}/docker/Dockerfile
|
||||
|
|
2
.github/workflows/main.yml
vendored
|
@ -11,5 +11,5 @@ jobs:
|
|||
- name: Cypress run
|
||||
uses: cypress-io/github-action@v4
|
||||
with:
|
||||
build: node db.js
|
||||
build: node app/db.js
|
||||
start: npm start
|
||||
|
|
|
@ -13,11 +13,11 @@ Upcoming Features:
|
|||
Source:
|
||||
```Bash
|
||||
EBPASS=changeme
|
||||
EBPORT=4000
|
||||
EBPORT=3000
|
||||
EBAPI_KEY=changeme #ShareX support
|
||||
|
||||
$ npm install
|
||||
$ node db.js
|
||||
$ node app/db.js
|
||||
$ npm start
|
||||
```
|
||||
Default username is admin with the password being whatever EBPASS is
|
||||
|
@ -49,7 +49,7 @@ JSON
|
|||
|
||||
Docker config
|
||||
```
|
||||
docker run -d -p "4000:4000" -e EBPORT=4000 -e EBPASS=changeme -e EBAPI_KEY=changeme ghcr.io/waveringana/embedder:1.7.1
|
||||
docker run -d -p "3000:3000" -e EBPORT=3000 -e EBPASS=changeme -e EBAPI_KEY=changeme ghcr.io/waveringana/embedder:1.7.1
|
||||
```
|
||||
|
||||
Docker Compose
|
||||
|
|
|
@ -13,7 +13,7 @@ const path = require("path");
|
|||
const authRouter = require("./routes/auth");
|
||||
const indexRouter = require("./routes/index");
|
||||
|
||||
const db = require("./db");
|
||||
const db = require("./db").db;
|
||||
|
||||
let app = express();
|
||||
let server = http.createServer(app);
|
|
@ -22,13 +22,16 @@ db.serialize(function() {
|
|||
expire INTEGER \
|
||||
)");
|
||||
|
||||
// create an initial user (username: alice, password: letmein)
|
||||
var salt = crypto.randomBytes(16);
|
||||
db.run("INSERT OR IGNORE INTO users (username, hashed_password, salt) VALUES (?, ?, ?)", [
|
||||
"admin",
|
||||
crypto.pbkdf2Sync(process.env.EBPASS || "changeme", salt, 310000, 32, "sha256"),
|
||||
salt
|
||||
]);
|
||||
createUser("admin", process.env.EBPASS || "changeme");
|
||||
});
|
||||
|
||||
module.exports = db;
|
||||
function createUser(username, password) {
|
||||
var salt = crypto.randomBytes(16);
|
||||
db.run("INSERT OR IGNORE INTO users (username, hashed_password, salt) VALUES (?, ?, ?)", [
|
||||
username,
|
||||
crypto.pbkdf2Sync(password, salt, 310000, 32, "sha256"),
|
||||
salt
|
||||
]);
|
||||
}
|
||||
|
||||
module.exports = {db: db, createUser: createUser};
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 400 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 954 B After Width: | Height: | Size: 954 B |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
@ -3,7 +3,7 @@ const express = require("express");
|
|||
const passport = require("passport");
|
||||
const LocalStrategy = require("passport-local");
|
||||
|
||||
let db = require("../db");
|
||||
let db = require("../db").db;
|
||||
|
||||
let router = express.Router();
|
||||
|
|
@ -10,7 +10,7 @@ ffmpeg.setFfprobePath(ffprobepath);
|
|||
|
||||
const fs = require("fs");
|
||||
|
||||
let db = require("../db");
|
||||
let db = require("../db").db;
|
||||
let {checkAuth, convert, handleUpload} = require("./middleware");
|
||||
|
||||
function extension(str){
|
|
@ -7,7 +7,7 @@ ffmpeg.setFfprobePath(ffprobepath);
|
|||
const fs = require("fs");
|
||||
const process = require("process");
|
||||
|
||||
let db = require("../db.js");
|
||||
let db = require("../db.js").db;
|
||||
|
||||
function extension(str){
|
||||
let file = str.split("/").pop();
|
|
@ -79,7 +79,7 @@ return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2);
|
|||
<% } else if (extension(file.path) == ".jpg" || extension(file.path) == ".jpeg" || extension(file.path) == ".png" || extension(file.path) == ".gif" || extension(file.path) == ".webp" ) { %>
|
||||
<img class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)" loading="lazy">
|
||||
<% } else {%> <!-- non-media file -->
|
||||
<div class="nonmedia" onclick="copyPath('<%=file.path%>')">
|
||||
<div class="nonmedia" onclick="copyPath('/uploads/<%=file.path%>')">
|
||||
<p><%=extension(file.path)%> file</p>
|
||||
</div>
|
||||
<% } %>
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
node db.js
|
||||
npm start
|
|
@ -1,22 +1,22 @@
|
|||
FROM node:16-alpine AS BUILD_IMAGE
|
||||
|
||||
RUN apk add curl bash
|
||||
RUN apk add curl
|
||||
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
|
||||
|
||||
# Install dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
RUN npm prune --production
|
||||
|
||||
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
|
||||
RUN /usr/local/bin/node-prune
|
||||
|
||||
FROM node:16-alpine
|
||||
|
||||
COPY --from=BUILD_IMAGE /node_modules ./node_modules
|
||||
COPY . .
|
||||
COPY /app ./app
|
||||
COPY package*.json ./
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN node db.js
|
||||
RUN node /app/db.js
|
||||
|
||||
CMD ["npm", "start"]
|
|
@ -21,14 +21,13 @@
|
|||
},
|
||||
"license": "Unlicense",
|
||||
"scripts": {
|
||||
"start": "node ./app.js"
|
||||
"start": "node ./app/app.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
||||
"@ffprobe-installer/ffprobe": "^1.4.1",
|
||||
"connect-sqlite3": "^0.9.13",
|
||||
"cookie-parser": "~1.4.4",
|
||||
"cypress-real-events": "^1.7.4",
|
||||
"dotenv": "^8.6.0",
|
||||
"ejs": "^3.1.8",
|
||||
"express": "~4.16.1",
|
||||
|
@ -45,6 +44,7 @@
|
|||
"devDependencies": {
|
||||
"cypress": "^11.1.0",
|
||||
"cypress-file-upload": "^5.0.8",
|
||||
"cypress-real-events": "^1.7.4",
|
||||
"eslint": "^8.28.0"
|
||||
}
|
||||
}
|
||||
|
|