]> jfr.im git - uguu.git/commitdiff
fixes
authorGo Johansson (neku) <redacted>
Sun, 1 Jan 2023 11:53:42 +0000 (12:53 +0100)
committerGo Johansson (neku) <redacted>
Sun, 1 Jan 2023 11:53:42 +0000 (12:53 +0100)
Makefile
docker/Dockerfile
src/config.json
src/static/scripts/checkdb.sh
src/static/scripts/checkfiles.sh
src/templates/partials/lead.ejs

index 61a12b7a31021e455209c090b2b07024b036a72e..f6b8331ad3d79c3ff9c9672c878f49ffa7a8609e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ FILESDOMAIN = $(shell $(CURDIR)/$(NODEJQ) -r ".FILE_DOMAIN" $(CURDIR)/$(CONF))
 MAXSIZE = $(shell $(CURDIR)/$(NODEJQ) -r ".max_upload_size" $(CURDIR)/$(CONF))
 CONTACT_EMAIL = $(shell $(CURDIR)/$(NODEJQ) -r ".infoContact" $(CURDIR)/$(CONF))
 PKG_VERSION = $(shell $(CURDIR)/$(NODEJQ) -r ".version" $(CURDIR)/package.json)
+EXPIRE_TIME = $(shell $(CURDIR)/$(NODEJQ) -r ".expireTime" $(CURDIR)/package.json)
 TMPDIR = $(shell mktemp -d)
 DOCKER_IMAGE = "$(shell basename $(CURDIR) | tr [:upper:] [:lower:])"
 DOCKER_TAG = "$(DOCKER_TAG)"
@@ -90,12 +91,12 @@ npm_dependencies:
 build-container-no-cache:
                tar --exclude='uguuForDocker.tar.gz' --exclude='vendor' --exclude='node_modules' --exclude='build' --exclude='dist' --exclude='.git' -czf uguuForDocker.tar.gz src docker Makefile package.json package-lock.json
                mv uguuForDocker.tar.gz docker/
-               docker build -f docker/Dockerfile --build-arg VERSION=$(PKG_VERSION) --no-cache -t uguu:$(PKG_VERSION) .
+               docker build -f docker/Dockerfile --build-arg DOMAIN=$(SITEDOMAIN) --build-arg FILE_DOMAIN=$(FILESDOMAIN) --build-arg CONTACT_EMAIL=$(FILESDOMAIN) --build-arg MAX_SIZE=$(MAXSIZE) --build-arg MAX_SIZE=$(EXPIRE_TIME) --no-cache -t uguu:$(PKG_VERSION) .
 
 build-container:
                tar --exclude='uguuForDocker.tar.gz' --exclude='vendor' --exclude='node_modules' --exclude='build' --exclude='dist' --exclude='.git' -czf uguuForDocker.tar.gz src docker Makefile package.json package-lock.json
                mv uguuForDocker.tar.gz docker/
-               docker build -f docker/Dockerfile --build-arg DOMAIN=$(SITEDOMAIN) --build-arg FILE_DOMAIN=$(FILESDOMAIN) --build-arg CONTACT_EMAIL=$(FILESDOMAIN) --build-arg MAX_SIZE=$(MAXSIZE) -t uguu:$(PKG_VERSION) .
+               docker build -f docker/Dockerfile --build-arg DOMAIN=$(SITEDOMAIN) --build-arg FILE_DOMAIN=$(FILESDOMAIN) --build-arg CONTACT_EMAIL=$(FILESDOMAIN) --build-arg MAX_SIZE=$(MAXSIZE) --build-arg MAX_SIZE=$(EXPIRE_TIME) -t uguu:$(PKG_VERSION) .
 
 run-container:
                docker run --name uguu -d -p 80:80 -p 443:443 uguu:$(PKG_VERSION)
index 880e658fa6b0121a4ea3474a82d25e2a67f36080..76786321677db4a887c804c140a22db348d55f98 100644 (file)
@@ -19,13 +19,19 @@ RUN apt-get install -y build-essential nginx-full php8.1-fpm php8.1 sqlite3 php8
 # Set ENV values for configuration
 ARG DOMAIN
 ENV DOMAIN=$DOMAIN
+
 ARG FILE_DOMAIN
 ENV FILE_DOMAIN=$FILE_DOMAIN
+
 ARG CONTACT_EMAIL
 ENV CONTACT_EMAIL=$CONTACT_EMAIL
+
 ARG MAX_SIZE
 ENV MAX_SIZE=$MAX_SIZE
 
+ARG EXPIRE_TIME
+ENV EXPIRE_TIME=$EXPIRE_TIME
+
 # Set default workdir
 WORKDIR  /var/www/
 
@@ -59,6 +65,10 @@ RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \
 COPY docker/nginx/uguu.conf /etc/nginx/sites-enabled/uguu.conf
 COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
 
+# Modify expire time
+RUN sed -i "s#XXX#${EXPIRE_TIME}#g" /var/www/uguu/src/static/scripts/checkfiles.sh
+RUN sed -i "s#XXX#${EXPIRE_TIME}#g" /var/www/uguu/src/static/scripts/checkdb.sh
+
 # Modify nginx values
 RUN sed -i "s#XMAINDOMAINX#${DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
 RUN sed -i "s#XFILESDOMAINX#${FILE_DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
index 89a47635326a46f018b6fbd0f7f5b1035c91042a..da84c056f914f5c61a346931996a77d82b8cf483 100755 (executable)
@@ -10,7 +10,7 @@
     "tools.ejs"
   ],
   "max_upload_size": 128,
-  "expireTime": "48H",
+  "expireTime": "48",
   "siteName": "Uguu",
   "subTitle": "wahooo",
   "DOMAIN": "domain.com",
index 7f6916fac9e90eafa5643cd0555d772d66b15d5f..e2d27a8569a02875ed934effbc556669429cc244 100644 (file)
@@ -1 +1 @@
-sqlite3 /path/to/db/uguu.sq3 "DELETE FROM files WHERE date <= strftime('%s', datetime('now', '-1 day'));"
\ No newline at end of file
+sqlite3 /path/to/db/uguu.sq3 "DELETE FROM files WHERE date <= strftime('%s', datetime('now', '-XXX hours'));"
\ No newline at end of file
index 5c9e4bdbc1a916f782cb35573c06346d5cda9829..fff78b3aa51a09d14edf15028ab6eb49d8ac40e2 100644 (file)
@@ -1,2 +1,3 @@
 #! /bin/sh
+hours=$((XXX*60))
 find /path/to/files/ -mmin +1440 -exec rm -f {} \;
\ No newline at end of file
index 3dc236c821fc18ed531616033d017550f4e535d5..28ab9332e66204bfdc673e6b76ef7edb3d5159fa 100644 (file)
@@ -1,6 +1,6 @@
 <h1><%= siteName %>~</h1>
 <p class="lead">
-    Max upload size is <%= max_upload_size %>&nbsp;MiB & files expire after <%= expireTime %>, read the
+    Max upload size is <%= max_upload_size %>&nbsp;MiB & files expire after <%= expireTime %>H, read the
     <a href="faq.html">
         <abbr title="Frequently asked questions">FAQ</abbr>
     </a>