mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-11-04 22:13:32 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e19a32fc6b | ||
|
|
1712fea1d3 | ||
|
|
1ac4808a64 | ||
|
|
84fd5367ce | ||
|
|
337cfdc15b | ||
|
|
b979bd4f13 | ||
|
|
3cab902752 | ||
|
|
1d0dd2a69f | ||
|
|
17f439210a | ||
|
|
9970fd3f89 | ||
|
|
8b7bcceb7b | ||
|
|
93ebdabf6f | ||
|
|
0b278c989b | ||
|
|
518e771afe |
32
.github/dependabot.yml
vendored
32
.github/dependabot.yml
vendored
@@ -5,19 +5,19 @@
|
|||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
# Maintain dependencies for npm
|
- package-ecosystem: npm
|
||||||
- package-ecosystem: "npm" # See documentation for possible values
|
versioning-strategy: increase
|
||||||
versioning-strategy: increase
|
directory: "/"
|
||||||
directory: "/" # Location of package manifests
|
schedule:
|
||||||
schedule:
|
interval: daily
|
||||||
interval: "daily"
|
commit-message:
|
||||||
# Maintain dependencies for GitHub Actions
|
prefix: "build"
|
||||||
- package-ecosystem: "github-actions"
|
include: "scope"
|
||||||
directory: "/"
|
open-pull-requests-limit: 10
|
||||||
schedule:
|
- package-ecosystem: github-actions
|
||||||
interval: "daily"
|
directory: "/"
|
||||||
# Maintain dependencies for Docker
|
schedule:
|
||||||
- package-ecosystem: "docker"
|
interval: weekly
|
||||||
directory: "/"
|
commit-message:
|
||||||
schedule:
|
prefix: "build"
|
||||||
interval: "daily"
|
include: "scope"
|
||||||
21
.github/workflows/remove-docker-tag.yml
vendored
Normal file
21
.github/workflows/remove-docker-tag.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
name: Remove Docker Tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
remove-docker-tag:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
|
||||||
|
# (required)
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Remove Docker Tag
|
||||||
|
uses: ArchieAtkinson/remove-dockertag-action@v0.0
|
||||||
|
with:
|
||||||
|
tag_name: master
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.1.1](https://github.com/C4illin/ConvertX/compare/v0.1.0...v0.1.1) (2024-05-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* :bug: make sure all redirects are 302 ([9970fd3](https://github.com/C4illin/ConvertX/commit/9970fd3f89190af96f8762edc3817d1e03082b3a)), closes [#12](https://github.com/C4illin/ConvertX/issues/12)
|
||||||
|
|
||||||
## 0.1.0 (2024-05-30)
|
## 0.1.0 (2024-05-30)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||

|

|
||||||
# ConvertX
|
# ConvertX
|
||||||
[](https://github.com/C4illin/ConvertX/actions/workflows/docker-publish.yml)
|
[](https://github.com/C4illin/ConvertX/actions/workflows/docker-publish.yml)
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
A self-hosted online file converter. Supports 831 different formats. Written with Typescript, Bun and Elysia.
|
A self-hosted online file converter. Supports 831 different formats. Written with Typescript, Bun and Elysia.
|
||||||
|
|
||||||
@@ -28,7 +30,7 @@ A self-hosted online file converter. Supports 831 different formats. Written wit
|
|||||||
# docker-compose.yml
|
# docker-compose.yml
|
||||||
services:
|
services:
|
||||||
convertx:
|
convertx:
|
||||||
image: ghcr.io/c4illin/convertx:main
|
image: ghcr.io/c4illin/convertx
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment: # Defaults are listed below. All are optional.
|
environment: # Defaults are listed below. All are optional.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "convertx-frontend",
|
"name": "convertx-frontend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run --watch src/index.tsx",
|
"dev": "bun run --watch src/index.tsx",
|
||||||
"hot": "bun run --hot src/index.tsx",
|
"hot": "bun run --hot src/index.tsx",
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ const app = new Elysia()
|
|||||||
)
|
)
|
||||||
.get("/setup", ({ redirect }) => {
|
.get("/setup", ({ redirect }) => {
|
||||||
if (!FIRST_RUN) {
|
if (!FIRST_RUN) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -164,7 +164,7 @@ const app = new Elysia()
|
|||||||
})
|
})
|
||||||
.get("/register", ({ redirect }) => {
|
.get("/register", ({ redirect }) => {
|
||||||
if (!ACCOUNT_REGISTRATION) {
|
if (!ACCOUNT_REGISTRATION) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -206,7 +206,7 @@ const app = new Elysia()
|
|||||||
"/register",
|
"/register",
|
||||||
async ({ body, set, redirect, jwt, cookie: { auth } }) => {
|
async ({ body, set, redirect, jwt, cookie: { auth } }) => {
|
||||||
if (!ACCOUNT_REGISTRATION && !FIRST_RUN) {
|
if (!ACCOUNT_REGISTRATION && !FIRST_RUN) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FIRST_RUN) {
|
if (FIRST_RUN) {
|
||||||
@@ -253,13 +253,13 @@ const app = new Elysia()
|
|||||||
sameSite: "strict",
|
sameSite: "strict",
|
||||||
});
|
});
|
||||||
|
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
},
|
},
|
||||||
{ body: t.Object({ email: t.String(), password: t.String() }) },
|
{ body: t.Object({ email: t.String(), password: t.String() }) },
|
||||||
)
|
)
|
||||||
.get("/login", async ({ jwt, redirect, cookie: { auth } }) => {
|
.get("/login", async ({ jwt, redirect, cookie: { auth } }) => {
|
||||||
if (FIRST_RUN) {
|
if (FIRST_RUN) {
|
||||||
return redirect("/setup");
|
return redirect("/setup", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if already logged in, redirect to home
|
// if already logged in, redirect to home
|
||||||
@@ -267,7 +267,7 @@ const app = new Elysia()
|
|||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
auth.remove();
|
auth.remove();
|
||||||
@@ -361,7 +361,7 @@ const app = new Elysia()
|
|||||||
sameSite: "strict",
|
sameSite: "strict",
|
||||||
});
|
});
|
||||||
|
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
},
|
},
|
||||||
{ body: t.Object({ email: t.String(), password: t.String() }) },
|
{ body: t.Object({ email: t.String(), password: t.String() }) },
|
||||||
)
|
)
|
||||||
@@ -370,27 +370,27 @@ const app = new Elysia()
|
|||||||
auth.remove();
|
auth.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
})
|
})
|
||||||
.post("/logoff", ({ redirect, cookie: { auth } }) => {
|
.post("/logoff", ({ redirect, cookie: { auth } }) => {
|
||||||
if (auth?.value) {
|
if (auth?.value) {
|
||||||
auth.remove();
|
auth.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
})
|
})
|
||||||
.get("/", async ({ jwt, redirect, cookie: { auth, jobId } }) => {
|
.get("/", async ({ jwt, redirect, cookie: { auth, jobId } }) => {
|
||||||
if (FIRST_RUN) {
|
if (FIRST_RUN) {
|
||||||
return redirect("/setup");
|
return redirect("/setup", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
// validate jwt
|
// validate jwt
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure user exists in db
|
// make sure user exists in db
|
||||||
@@ -402,7 +402,7 @@ const app = new Elysia()
|
|||||||
if (auth?.value) {
|
if (auth?.value) {
|
||||||
auth.remove();
|
auth.remove();
|
||||||
}
|
}
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new job
|
// create a new job
|
||||||
@@ -509,16 +509,16 @@ const app = new Elysia()
|
|||||||
"/upload",
|
"/upload",
|
||||||
async ({ body, redirect, jwt, cookie: { auth, jobId } }) => {
|
async ({ body, redirect, jwt, cookie: { auth, jobId } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jobId?.value) {
|
if (!jobId?.value) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingJob = await db
|
const existingJob = await db
|
||||||
@@ -526,7 +526,7 @@ const app = new Elysia()
|
|||||||
.get(jobId.value, user.id);
|
.get(jobId.value, user.id);
|
||||||
|
|
||||||
if (!existingJob) {
|
if (!existingJob) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userUploadsDir = `${uploadsDir}${user.id}/${jobId.value}/`;
|
const userUploadsDir = `${uploadsDir}${user.id}/${jobId.value}/`;
|
||||||
@@ -557,16 +557,16 @@ const app = new Elysia()
|
|||||||
"/delete",
|
"/delete",
|
||||||
async ({ body, redirect, jwt, cookie: { auth, jobId } }) => {
|
async ({ body, redirect, jwt, cookie: { auth, jobId } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jobId?.value) {
|
if (!jobId?.value) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingJob = await db
|
const existingJob = await db
|
||||||
@@ -574,7 +574,7 @@ const app = new Elysia()
|
|||||||
.get(jobId.value, user.id);
|
.get(jobId.value, user.id);
|
||||||
|
|
||||||
if (!existingJob) {
|
if (!existingJob) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userUploadsDir = `${uploadsDir}${user.id}/${jobId.value}/`;
|
const userUploadsDir = `${uploadsDir}${user.id}/${jobId.value}/`;
|
||||||
@@ -587,16 +587,16 @@ const app = new Elysia()
|
|||||||
"/convert",
|
"/convert",
|
||||||
async ({ body, redirect, jwt, cookie: { auth, jobId } }) => {
|
async ({ body, redirect, jwt, cookie: { auth, jobId } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jobId?.value) {
|
if (!jobId?.value) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingJob = (await db
|
const existingJob = (await db
|
||||||
@@ -604,7 +604,7 @@ const app = new Elysia()
|
|||||||
.get(jobId.value, user.id)) as IJobs;
|
.get(jobId.value, user.id)) as IJobs;
|
||||||
|
|
||||||
if (!existingJob) {
|
if (!existingJob) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userUploadsDir = `${uploadsDir}${user.id}/${jobId.value}/`;
|
const userUploadsDir = `${uploadsDir}${user.id}/${jobId.value}/`;
|
||||||
@@ -627,7 +627,7 @@ const app = new Elysia()
|
|||||||
const fileNames = JSON.parse(body.file_names) as string[];
|
const fileNames = JSON.parse(body.file_names) as string[];
|
||||||
|
|
||||||
if (!Array.isArray(fileNames) || fileNames.length === 0) {
|
if (!Array.isArray(fileNames) || fileNames.length === 0) {
|
||||||
return redirect("/");
|
return redirect("/", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.run(
|
db.run(
|
||||||
@@ -677,7 +677,7 @@ const app = new Elysia()
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Redirect the client immediately
|
// Redirect the client immediately
|
||||||
return redirect(`/results/${jobId.value}`);
|
return redirect(`/results/, 302${jobId.value}`);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
body: t.Object({
|
body: t.Object({
|
||||||
@@ -688,12 +688,12 @@ const app = new Elysia()
|
|||||||
)
|
)
|
||||||
.get("/history", async ({ jwt, redirect, cookie: { auth } }) => {
|
.get("/history", async ({ jwt, redirect, cookie: { auth } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
let userJobs = db
|
let userJobs = db
|
||||||
@@ -751,7 +751,7 @@ const app = new Elysia()
|
|||||||
"/results/:jobId",
|
"/results/:jobId",
|
||||||
async ({ params, jwt, set, redirect, cookie: { auth, job_id } }) => {
|
async ({ params, jwt, set, redirect, cookie: { auth, job_id } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (job_id?.value) {
|
if (job_id?.value) {
|
||||||
@@ -761,7 +761,7 @@ const app = new Elysia()
|
|||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const job = (await db
|
const job = (await db
|
||||||
@@ -846,7 +846,7 @@ const app = new Elysia()
|
|||||||
"/progress/:jobId",
|
"/progress/:jobId",
|
||||||
async ({ jwt, set, params, redirect, cookie: { auth, job_id } }) => {
|
async ({ jwt, set, params, redirect, cookie: { auth, job_id } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (job_id?.value) {
|
if (job_id?.value) {
|
||||||
@@ -856,7 +856,7 @@ const app = new Elysia()
|
|||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const job = (await db
|
const job = (await db
|
||||||
@@ -934,12 +934,12 @@ const app = new Elysia()
|
|||||||
"/download/:userId/:jobId/:fileName",
|
"/download/:userId/:jobId/:fileName",
|
||||||
async ({ params, jwt, redirect, cookie: { auth } }) => {
|
async ({ params, jwt, redirect, cookie: { auth } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const job = await db
|
const job = await db
|
||||||
@@ -947,7 +947,7 @@ const app = new Elysia()
|
|||||||
.get(user.id, params.jobId);
|
.get(user.id, params.jobId);
|
||||||
|
|
||||||
if (!job) {
|
if (!job) {
|
||||||
return redirect("/results");
|
return redirect("/results", 302);
|
||||||
}
|
}
|
||||||
// parse from url encoded string
|
// parse from url encoded string
|
||||||
const userId = decodeURIComponent(params.userId);
|
const userId = decodeURIComponent(params.userId);
|
||||||
@@ -960,12 +960,12 @@ const app = new Elysia()
|
|||||||
)
|
)
|
||||||
.get("/converters", async ({ jwt, redirect, cookie: { auth } }) => {
|
.get("/converters", async ({ jwt, redirect, cookie: { auth } }) => {
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -1022,12 +1022,12 @@ const app = new Elysia()
|
|||||||
async ({ params, jwt, redirect, cookie: { auth } }) => {
|
async ({ params, jwt, redirect, cookie: { auth } }) => {
|
||||||
// TODO: Implement zip download
|
// TODO: Implement zip download
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await jwt.verify(auth.value);
|
const user = await jwt.verify(auth.value);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return redirect("/login");
|
return redirect("/login", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const job = await db
|
const job = await db
|
||||||
@@ -1035,7 +1035,7 @@ const app = new Elysia()
|
|||||||
.get(user.id, params.jobId);
|
.get(user.id, params.jobId);
|
||||||
|
|
||||||
if (!job) {
|
if (!job) {
|
||||||
return redirect("/results");
|
return redirect("/results", 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userId = decodeURIComponent(params.userId);
|
const userId = decodeURIComponent(params.userId);
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
article {
|
|
||||||
/* height: 300px; */
|
|
||||||
/* width: 300px; */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
div.icon {
|
div.icon {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
|
|||||||
Reference in New Issue
Block a user