0
Fork 0
mirror of https://github.com/stonith404/pingvin-share.git synced 2025-02-05 01:38:56 -05:00

fixed expiration date

This commit is contained in:
Elias Schneider 2022-04-25 17:58:03 +02:00
parent d6718cc545
commit b26578a409
No known key found for this signature in database
GPG key ID: D5EC1C72D93244FD
6 changed files with 11 additions and 8 deletions

View file

@ -1,6 +1,4 @@
APPWRITE_FUNCTION_API_KEY= APPWRITE_FUNCTION_API_KEY=
# IMPORTANT If you're running the website inside docker and your Appwrite instance runs on localhost host, NEXT_PUBLIC_APPWRITE_HOST=http://localhost:86/v1
# use host.docker.internal instead of localhost
NEXT_PUBLIC_APPWRITE_HOST=http://host.docker.internal/v1
# Must be the same as in the _APP_STORAGE_LIMIT in the Appwrite env file # Must be the same as in the _APP_STORAGE_LIMIT in the Appwrite env file
NEXT_PUBLIC_MAX_FILE_SIZE=300000000 NEXT_PUBLIC_MAX_FILE_SIZE=300000000

View file

@ -2,7 +2,7 @@ import axios from "axios";
const api = () => const api = () =>
axios.create({ axios.create({
baseURL: process.env["NEXT_PUBLIC_APPWRITE_HOST"], baseURL: process.env["APPWRITE_HOST"],
headers: { headers: {
cookie: `a_session_console=${process.env["APPWRITE_USER_TOKEN"]}`, cookie: `a_session_console=${process.env["APPWRITE_USER_TOKEN"]}`,
}, },

View file

@ -3,7 +3,7 @@ const aw = () => {
let client = new sdk.Client(); let client = new sdk.Client();
client client
.setEndpoint(process.env["NEXT_PUBLIC_APPWRITE_HOST"]) .setEndpoint(process.env["APPWRITE_HOST"])
.setProject("pingvin-share") .setProject("pingvin-share")
.setKey(process.env["APPWRITE_API_KEY"]) .setKey(process.env["APPWRITE_API_KEY"])
.setSelfSigned(); .setSelfSigned();

View file

@ -8,7 +8,7 @@
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
"init:appwrite": "cd .setup && npm install && npx ts-node index.ts", "init:appwrite": "cd .setup && npm install && npx ts-node index.ts",
"deploy": "docker buildx build -t git.elias.li/stonith404/pingvin-share:latest --platform linux/amd64,linux/arm64 --push ." "deploy": "docker build -t git.elias.li/stonith404/pingvin-share:latest . && docker push git.elias.li/stonith404/pingvin-share:latest"
}, },
"dependencies": { "dependencies": {
"@mantine/core": "^4.1.3", "@mantine/core": "^4.1.3",

View file

@ -52,7 +52,7 @@ const Upload = () => {
showCompletedUploadModal( showCompletedUploadModal(
modals, modals,
`${window.location.origin}/share/${bucketId}`, `${window.location.origin}/share/${bucketId}`,
new Date(Date.now()).toLocaleString() new Date(Date.now() + expiration * 60 * 1000).toLocaleString()
); );
} }
}, },

View file

@ -4,7 +4,12 @@ import sdk from "node-appwrite";
const client = new sdk.Client(); const client = new sdk.Client();
client client
.setEndpoint(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string) .setEndpoint(
(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string).replace(
"localhost",
"host.docker.internal"
)
)
.setProject("pingvin-share") .setProject("pingvin-share")
.setKey(process.env["APPWRITE_FUNCTION_API_KEY"] as string); .setKey(process.env["APPWRITE_FUNCTION_API_KEY"] as string);