* Migrated ur an sqlite database

* Removed unnecessary IOExceptions

* Removed an util class not needed anymore

* Updated README.md and docker-compose.yml to reflect new storage mechanism

* This change was not meant for this branch

* Port change with environment variable

* Unused imports

* Updated README.md

* Added basic protection against duplication
This commit is contained in:
Przemek Dragańczuk 2020-05-23 19:16:27 +02:00 committed by GitHub
parent 425b8a5f44
commit 218f2fa368
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 11 deletions

View File

@ -19,6 +19,21 @@ unnecessary features, or they didn't have all the features I wanted.
written in plain HTML and vanilla JS, using [Pure CSS](https://purecss.io/) written in plain HTML and vanilla JS, using [Pure CSS](https://purecss.io/)
for styling for styling
# Bloat that will not be implemented
- Logging, tracking or spying of any kind. The only logs that still exist are
errors printed to stderr and the default SLF4J warning
- User management. If you need a shortener for your whole organisation, either
run separate containers for everyone or use something else
- Cookies, newsletters, "we value your privacy" popups or any of the multiple
other ways modern web shows how anti-user it is. We all hate those and they're
not needed here
- Paywalls or messages beging for donations. If you want to support me (for
whatever reason), you can message me through Github issues or via email
[github@draganczuk.tk](mailto:github@draganczuk.tk)
I _might_ add one of those "fork me on github" thingies in the corner, though I
doubt I will
# Screenshot # Screenshot
![Screenshot](./screenshot.png) ![Screenshot](./screenshot.png)
@ -55,6 +70,8 @@ export db.url=<url> # Default: './urls.sqlite'
``` ```
java -jar build/libs/url.jar java -jar build/libs/url.jar
``` ```
You can optionally set the port the server listens on by appending `--port=[port]`
### 4. Navigate to `http://localhost:4567` in your browser, add links as you wish. ### 4. Navigate to `http://localhost:4567` in your browser, add links as you wish.
## Running with docker ## Running with docker

View File

@ -1,7 +1,5 @@
package tk.draganczuk.url; package tk.draganczuk.url;
import spark.Filter;
import static spark.Spark.*; import static spark.Spark.*;
public class App { public class App {
@ -17,7 +15,7 @@ public class App {
staticFiles.location("/public"); staticFiles.location("/public");
} }
port(Integer.parseInt(System.getProperty("port", "4567"))); port(Integer.parseInt(System.getenv().getOrDefault("port", "4567")));
// Add GZIP compression // Add GZIP compression
after(Filters::addGZIP); after(Filters::addGZIP);

View File

@ -4,8 +4,6 @@ import org.eclipse.jetty.http.HttpStatus;
import spark.Request; import spark.Request;
import spark.Response; import spark.Response;
import java.io.IOException;
public class Routes { public class Routes {
private static UrlRepository urlRepository; private static UrlRepository urlRepository;

View File

@ -1,10 +1,5 @@
package tk.draganczuk.url; package tk.draganczuk.url;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;