Skip to content

Commit

Permalink
add web support
Browse files Browse the repository at this point in the history
  • Loading branch information
andyxning committed Apr 23, 2016
1 parent 25651af commit bf3bd5c
Show file tree
Hide file tree
Showing 26 changed files with 7,247 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ _testmain.go
*.prof

shortme
donate
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ Currently, afaik, there are three ways to implement short url service.
* Connection #0 to host 127.0.0.1 left intact
```

### Web
----
The web interface mainly used to make url shorting service more intuitively.

For **short** option, the shorted url, shorted url qr code and the
corresponding long page is shown.

For **expand** option, the expanded url, expanded url qr code and the
corresponding expanded page is shown.

### Install
----
#### Dependency
Expand Down Expand Up @@ -322,3 +332,9 @@ For example, we can shard according to the **base integer** using **modula hash

In conclusion, there are many factors to consider before we can make a
decision which hash algorithm to use.


### Problems
----
* long url may make the generated qr code unreadable. I have test this in my
self phone. This remains to be tested more meticulous.
1 change: 0 additions & 1 deletion base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
// Int2String converts an unsigned 64bit integer to a string.
func Int2String(seq uint64) (shortURL string) {
charSeq := []rune{}

if seq != 0 {
for seq != 0 {
mod := seq % conf.Conf.Common.BaseStringLength
Expand Down
1 change: 1 addition & 0 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type common struct {
BaseString string `toml:"base_string"`
BaseStringLength uint64
DomainName string `toml:"domain_name"`
Schema string `toml:"schema"`
}

type config struct {
Expand Down
3 changes: 1 addition & 2 deletions conf/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"runtime"
)


const Version = "1.0.0"
const Version = "1.2.0"

func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
Expand Down
7 changes: 5 additions & 2 deletions config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ max_open_conns = 8

[common]
# short urls that will be filtered to use
black_short_urls = ["version","health","short","expand","fuck","stupid"]
black_short_urls = ["version","health","short","expand","css","js","fuck","stupid"]

# Base string used to generate short url
base_string = "Ds3K9ZNvWmHcakr1oPnxh4qpMEzAye8wX5IdJ2LFujUgtC07lOTb6GYBQViSfR"

# Short url service domain name. This is used to filter short url loop.
domain_name = "short.me:3030"
domain_name = "127.0.0.1:3030"

# Short url service schema: http or https.
schema = "http"
Binary file added favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"

"github.com/andyxning/shortme/conf"
"github.com/andyxning/shortme/api"
"github.com/andyxning/shortme/web"
"github.com/andyxning/shortme/short"
)

Expand All @@ -29,5 +29,5 @@ func main() {
short.Start()

// api
api.Start()
web.Start()
}
Loading

0 comments on commit bf3bd5c

Please sign in to comment.