Bump version to 1.0.0

This commit is contained in:
Tom Andrade 2019-04-29 21:42:36 +02:00
parent 554af81c01
commit c3b26395e1
Signed by: wolvie
GPG Key ID: 31AAB07872E82669
3 changed files with 30 additions and 13 deletions

View File

@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
## 2019-04-29 - 1.0.0
### Added
- Default to https for empty scheme URLs
- Refactoring variables names/usage
- Add html templates
- Improved URL validation
- Control flag for shortened URL size
- README typos
## 2019-04-28 - 0.2.0 ## 2019-04-28 - 0.2.0
### Added ### Added

View File

@ -10,20 +10,20 @@ Short is a very simple url shortener build in golang using gorilla/mux for url r
```shell ```shell
Usage of short: Usage of short:
-addr string -addr string
Address to listen for connections (default "localhost") Address to listen for connections (default "localhost")
-domain string -domain string
Domain to write to the URLs (default "localhost") Domain to write to the URLs (default "localhost")
-dump string -dump string
Path to the file to dump the kv db (default "urls.json") Path to the file to dump the kv db (default "urls.json")
-path string -path string
Path to the base URL (https://localhost:8080/PATH/... remember to append a / at the end Path to the base URL (https://localhost/PATH/... remember to append a / at the end
-port string -port string
Port to listen for connections (default "8080") Port to listen for connections (default "8080")
-proto string -proto string
proto to the base URL (HTTPS://localhost:8080/path/... no real https here just to set the url (for like a proxy offloading https (default "https") proto to the base URL (HTTPS://localhost/path/... no real https here just to set the url (for like a proxy offloading https (default "https")
-v -urlsize int
prints current version Define the size of the shortened String, default 10 (default 10)
-v prints current version
``` ```
Includes a Dockerfile to for a standalone docker image. Includes a Dockerfile to for a standalone docker image.
@ -35,9 +35,11 @@ curl -X POST -d "url=http://google.com" http://localhost:8080/
URL shortened at: https://localhost:8080/9mbIcOwsVP URL shortened at: https://localhost:8080/9mbIcOwsVP
``` ```
URLs missing a Scheme (http[s]://) will be defaulted to https
## Dump/Restore endpoints ## Dump/Restore endpoints
URL mapping data can be checked, listed, dumped and restored in the given endpoints: URLs for mapping data can be checked, listed, dumped and restored in the given endpoints (you might want (and you should) restrict access to this e.g. reverse proxy):
Show the number of mapped urls Show the number of mapped urls
@ -74,4 +76,8 @@ $ curl -X POST http://localhost:8080/v1/fromPost \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
--data $(cat save.json ) --data $(cat save.json )
OK OK
``` ```
## HTML templates
A simple collection of html templates are put on `templates` folder, the templates I've used are based on @jspark721 "UI 404 PAGE" on [freefrontend](https://codepen.io/juliepark/pen/erOoeZ)

View File

@ -29,7 +29,7 @@ const (
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
) )
const ( const (
appVersion = "0.2.0" appVersion = "1.0.0"
) )
var domain string var domain string
@ -77,7 +77,7 @@ func redirect(w http.ResponseWriter, r *http.Request) {
key = rgx.FindString(key) key = rgx.FindString(key)
key, status := get(key) key, status := get(key)
if status { if status {
u, _ := url.Parse(key) u, _ := url.Parse(key)
if u.Scheme == "" { if u.Scheme == "" {
u.Scheme = "https" u.Scheme = "https"
} }