mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-22 17:26:45 +00:00
Sqlite (#2)
* 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:
parent
425b8a5f44
commit
218f2fa368
17
README.md
17
README.md
@ -18,6 +18,21 @@ unnecessary features, or they didn't have all the features I wanted.
|
|||||||
- Backend written in Java using [Spark Java](http://sparkjava.com/), frontend
|
- Backend written in Java using [Spark Java](http://sparkjava.com/), frontend
|
||||||
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
|
||||||
|
@ -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,13 +15,13 @@ 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);
|
||||||
|
|
||||||
// No need to auth in dev
|
// No need to auth in dev
|
||||||
if(System.getenv("dev") == null) {
|
if (System.getenv("dev") == null) {
|
||||||
// Authenticate
|
// Authenticate
|
||||||
before("/api/*", Filters.createAuthFilter());
|
before("/api/*", Filters.createAuthFilter());
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user