Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ _testmain.go
*.prof

vendor
rbaskets
.DS_Store
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Configuration of basket responses:

### Build from source

Build latest:
#### Build with go get

```bash
$ go get github.com/darklynx/request-baskets
Expand All @@ -69,6 +69,22 @@ $ export PATH=$PATH:$GOPATH/bin
$ request-baskets
```

#### Build in the repo
```bash
git clone https://github.com/darklynx/request-baskets.git
cd request-baskets

# macOS Apple Silicon
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -a -installsuffix cgo \
-ldflags="-w -s " \
-o ./rbaskets

# linux amd64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo \
-ldflags="-w -s " \
-o ./rbaskets
```

### Run docker container

```
Expand Down
6 changes: 4 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ func CreateServer(config *ServerConfig) *http.Server {
router.GET(pathPrefix+"/", ForwardToWeb)
router.GET(pathPrefix+"/"+serviceUIPath, WebIndexPage)
router.GET(pathPrefix+"/"+serviceUIPath+"/:basket", WebBasketPage)
//router.ServeFiles(pathPrefix+"/"+serviceUIPath+"/*filepath", http.Dir("./web"))

// static assets serving
router.ServeFiles(pathPrefix+"/static/*filepath", http.Dir("./static"))

// basket requests
router.NotFound = http.HandlerFunc(AcceptBasketRequests)

log.Printf("[info] HTTP server is listening on %s:%d", serverConfig.ServerAddr, serverConfig.ServerPort)
log.Printf("[info] HTTP server is listening on http://%s:%d", serverConfig.ServerAddr, serverConfig.ServerPort)
server := &http.Server{Addr: fmt.Sprintf("%s:%d", serverConfig.ServerAddr, serverConfig.ServerPort), Handler: router}

go shutdownHook()
Expand Down
6 changes: 6 additions & 0 deletions static/css/bootstrap-3.3.7.min.css

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions static/css/bootstrap-dark-1.0.0.min.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions static/css/bootstrap-theme-3.3.7.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions static/css/bootswatch-flatly-3.3.7.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions static/css/font-awesome-4.6.3.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions static/css/highlight-default-9.12.0.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added static/fonts/FontAwesome.otf
Binary file not shown.
Binary file added static/fonts/fontawesome-webfont.eot
Binary file not shown.
2,671 changes: 2,671 additions & 0 deletions static/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/fonts/fontawesome-webfont.ttf
Binary file not shown.
Binary file added static/fonts/fontawesome-webfont.woff
Binary file not shown.
Binary file added static/fonts/fontawesome-webfont.woff2
Binary file not shown.
Binary file added static/fonts/glyphicons-halflings-regular.eot
Binary file not shown.
288 changes: 288 additions & 0 deletions static/fonts/glyphicons-halflings-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/fonts/glyphicons-halflings-regular.ttf
Binary file not shown.
Binary file added static/fonts/glyphicons-halflings-regular.woff
Binary file not shown.
Binary file added static/fonts/glyphicons-halflings-regular.woff2
Binary file not shown.
7 changes: 7 additions & 0 deletions static/js/bootstrap-3.3.7.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions static/js/highlight-9.12.0.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions static/js/jquery-3.6.4.min.js

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions themes.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import "html/template"
const (
ThemeStandard = "standard"
themeStandardCSS = `
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">`
<link rel="stylesheet" href="/static/css/bootstrap-3.3.7.min.css">
<link rel="stylesheet" href="/static/css/bootstrap-theme-3.3.7.min.css">`
ThemeAdaptive = "adaptive"
themeAdaptiveCSS = `
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/darklynx/requestbaskets-dark-theme@1.0.0/bootstrap.min.css" integrity="sha384-QiFF09wqK5z3/usps1yc+Om75gf8byvdtluQfS0enYGx1nmji2dEbtgRDw1Tw60j" crossorigin="anonymous">`
<link rel="stylesheet" href="/static/css/bootstrap-dark-1.0.0.min.css">`
ThemeFlatly = "flatly"
themeFlatlyCSS = `
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css">`
<link rel="stylesheet" href="/static/css/bootswatch-flatly-3.3.7.min.css">`
)

func toThemeCSS(theme string) template.HTML {
Expand Down
8 changes: 4 additions & 4 deletions web_basket.html.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const (
<html>
<head lang="en">
<title>Request Basket: {{.Basket}}</title>{{.ThemeCSS}}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<link rel="stylesheet" href="/static/css/highlight-default-9.12.0.min.css">
<script src="/static/js/jquery-3.6.4.min.js"></script>
<script src="/static/js/bootstrap-3.3.7.min.js"></script>
<script src="/static/js/highlight-9.12.0.min.js"></script>

<style>
body { padding-top: 70px; }
Expand Down
6 changes: 3 additions & 3 deletions web_baskets.html.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ var (
<html>
<head lang="en">
<title>Request Baskets - Administration</title>{{.ThemeCSS}}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="/static/css/font-awesome-4.6.3.min.css">
<script src="/static/js/jquery-3.6.4.min.js"></script>
<script src="/static/js/bootstrap-3.3.7.min.js"></script>

<style>
html { position: relative; min-height: 100%; }
Expand Down
6 changes: 3 additions & 3 deletions web_index.html.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ var (
<html>
<head lang="en">
<title>Request Baskets</title>{{.ThemeCSS}}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="/static/css/font-awesome-4.6.3.min.css">
<script src="/static/js/jquery-3.6.4.min.js"></script>
<script src="/static/js/bootstrap-3.3.7.min.js"></script>

<style>
html { position: relative; min-height: 100%; }
Expand Down