Permalink
Browse files

Initial commit.

  • Loading branch information...
tamasd committed Oct 26, 2015
0 parents commit b79b6cfe26c800998eef730877d8304689cc3736
Showing with 11,965 additions and 0 deletions.
  1. +5 −0 .babelrc
  2. +8 −0 .gitignore
  3. +7 −0 Dockerfile
  4. +661 −0 LICENSE.txt
  5. +40 −0 Makefile
  6. 0 assets/.keep
  7. BIN assets/images/apple-touch-icon-114x114-precomposed.png
  8. BIN assets/images/apple-touch-icon-120x120-precomposed.png
  9. BIN assets/images/apple-touch-icon-144x144-precomposed.png
  10. BIN assets/images/apple-touch-icon-152x152-precomposed.png
  11. BIN assets/images/apple-touch-icon-57x57-precomposed.png
  12. BIN assets/images/apple-touch-icon-72x72-precomposed.png
  13. BIN assets/images/apple-touch-icon-76x76-precomposed.png
  14. BIN assets/images/favicon.ico
  15. BIN assets/images/walkhub-official-logo.jpg
  16. +62 −0 bootstrap.config.js
  17. +1 −0 bootstrap.config.less
  18. +73 −0 cmd/walkhub/main.go
  19. +74 −0 cmd/wh-rebuildsearch/main.go
  20. +11 −0 config.json.sample
  21. +11 −0 docker-compose.yml
  22. +47 −0 embedlog.go
  23. +194 −0 embedloggen.go
  24. +38 −0 html/index.html
  25. +27 −0 html/start.html
  26. +33 −0 js/actions/auth_provider.js
  27. +31 −0 js/actions/embedlog.js
  28. +30 −0 js/actions/router.js
  29. +31 −0 js/actions/search.js
  30. +33 −0 js/actions/user.js
  31. +42 −0 js/actions/walkhub_backend.js
  32. +53 −0 js/actions/walkthrough.js
  33. +243 −0 js/client/embed.js
  34. +40 −0 js/client/walkhub.js
  35. +433 −0 js/client/walkthrough/bubble.js
  36. +191 −0 js/client/walkthrough/client.js
  37. +209 −0 js/client/walkthrough/command_dispatcher.js
  38. +46 −0 js/client/walkthrough/context.js
  39. +300 −0 js/client/walkthrough/controller.js
  40. +224 −0 js/client/walkthrough/editdialog.js
  41. +37 −0 js/client/walkthrough/enforcer.js
  42. +281 −0 js/client/walkthrough/eventabsorber.js
  43. +199 −0 js/client/walkthrough/executor.js
  44. +346 −0 js/client/walkthrough/locator_generator.js
  45. +69 −0 js/client/walkthrough/logger.js
  46. +101 −0 js/client/walkthrough/proxy_server.js
  47. +176 −0 js/client/walkthrough/recorder.js
  48. +59 −0 js/client/walkthrough/social_sharing.js
  49. +175 −0 js/client/walkthrough/translator.js
  50. +145 −0 js/client/walkthrough/util.js
  51. +29 −0 js/client/walkthrough_start.js
  52. +56 −0 js/components/app.js
  53. +61 −0 js/components/bar.js
  54. +54 −0 js/components/connect.js
  55. +77 −0 js/components/embedcode.js
  56. +143 −0 js/components/embedcodebuilder.js
  57. +52 −0 js/components/errorbar.js
  58. +43 −0 js/components/frontpage.js
  59. +38 −0 js/components/helpbutton.js
  60. +53 −0 js/components/modal.js
  61. +61 −0 js/components/navbar.js
  62. +44 −0 js/components/notloggedin.js
  63. +96 −0 js/components/record.js
  64. +58 −0 js/components/recordsaved.js
  65. +91 −0 js/components/search.js
  66. +43 −0 js/components/step.js
  67. +58 −0 js/components/stepedit.js
  68. +29 −0 js/components/user.js
  69. +134 −0 js/components/walkhub_iframe.js
  70. +136 −0 js/components/walkthrough.js
  71. +91 −0 js/components/walkthroughedit.js
  72. +49 −0 js/components/walkthroughitem.js
  73. +105 −0 js/components/wrappers/app.js
  74. +44 −0 js/components/wrappers/connect.js
  75. +113 −0 js/components/wrappers/embedcodebuilder.js
  76. +46 −0 js/components/wrappers/frontpage.js
  77. +78 −0 js/components/wrappers/loggedin.js
  78. +218 −0 js/components/wrappers/record.js
  79. +128 −0 js/components/wrappers/search.js
  80. +206 −0 js/components/wrappers/walkthrough.js
  81. +89 −0 js/components/wrappers/walkthroughplay.js
  82. +21 −0 js/control.js
  83. +207 −0 js/form.js
  84. +44 −0 js/module.js
  85. +41 −0 js/routes.js
  86. +34 −0 js/sources/auth_provider.js
  87. +37 −0 js/sources/embedlog.js
  88. +39 −0 js/sources/search.js
  89. +34 −0 js/sources/user.js
  90. +90 −0 js/sources/walkthrough.js
  91. +45 −0 js/stores/auth_provider.js
  92. +44 −0 js/stores/currentuser.js
  93. +29 −0 js/stores/embedlog.js
  94. +45 −0 js/stores/search.js
  95. +44 −0 js/stores/user.js
  96. +104 −0 js/stores/walkthrough.js
  97. +41 −0 js/t.js
  98. +129 −0 js/util.js
  99. +307 −0 js/walkhub_backend.js
  100. +135 −0 less/style.less
  101. +37 −0 package.json
  102. 0 public/.keep
  103. +31 −0 sass/_aspect-ratio.scss
  104. +395 −0 sass/_bubble.scss
  105. +23 −0 sass/_context-calc.scss
  106. +29 −0 sass/_font-face.scss
  107. +52 −0 sass/_fonts.scss
  108. +101 −0 sass/_functions.scss
  109. +228 −0 sass/_media-queries.scss
  110. +266 −0 sass/_mixins.scss
  111. +417 −0 sass/_normalize.scss
  112. +69 −0 sass/_reset.scss
  113. +24 −0 sass/_strip-units.scss
  114. BIN sass/arrow-bottom.png
  115. BIN sass/arrow-left.png
  116. BIN sass/arrow-right.png
  117. BIN sass/arrow-top.png
  118. +116 −0 sass/selection.json
  119. +73 −0 sass/walkthrough.scss
  120. BIN sass/wtbubble.eot
  121. +14 −0 sass/wtbubble.svg
  122. BIN sass/wtbubble.ttf
  123. BIN sass/wtbubble.woff
  124. +108 −0 server.go
  125. +96 −0 user.go
  126. +352 −0 usergen.go
  127. +318 −0 walkthrough.go
  128. +352 −0 walkthroughgen.go
  129. +85 −0 webpack.config.js
@@ -0,0 +1,5 @@
{
"optional": ["runtime"],
"stage": 0,
"comments": false
}
@@ -0,0 +1,8 @@
config.json
config.json.*
!config.json.sample
assets/*
!assets/images/
dist
public/*
test.toml
@@ -0,0 +1,7 @@
FROM golang:latest
ADD . /opt/walkhub
ENV HOST 0.0.0.0
ENV PORT 80
WORKDIR /opt/walkhub
ENTRYPOINT /opt/walkhub/walkhub
EXPOSE 80

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,40 @@
.PHONY: all buildfrontend buildbackend preparefrontend update clean mrproper docker preparedocker rebuildsearch
all: buildfrontend buildbackend rebuildsearch
buildfrontend: preparefrontend
npm run build
buildbackend:
go build -o walkhub cmd/walkhub/main.go
preparefrontend:
npm install
mkdir -p public
mkdir -p assets
update:
npm update
clean:
rm assets/*
[ ! -e walkhub ] || rm ./walkhub
rm -r dist
mrproper: clean
rm -r node_modules
preparedocker: all
mkdir -p dist
cp walkhub dist
cp wh-rebuildsearch dist
cp config.json dist
cp -R assets dist
cp -R public dist
cp Dockerfile dist
docker: preparedocker
cd dist && docker build -t pronovix/walkhub-service .
rebuildsearch:
go build -o wh-rebuildsearch cmd/wh-rebuildsearch/main.go
No changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,62 @@
"use strict";
module.exports = {
scripts: {
"transition": true,
"alert": true,
"button": true,
"carousel": true,
"collapse": true,
"dropdown": true,
"modal": true,
"tooltip": true,
"popover": true,
"scrollspy": true,
"tab": true,
"affix": true
},
styles: {
"mixins": true,
"normalize": true,
"print": true,
"scaffolding": true,
"type": true,
"code": true,
"grid": true,
"tables": true,
"forms": true,
"buttons": true,
"component-animations": true,
"glyphicons": true,
"dropdowns": true,
"button-groups": true,
"input-groups": true,
"navs": true,
"navbar": true,
"breadcrumbs": true,
"pagination": true,
"pager": true,
"labels": true,
"badges": true,
"jumbotron": true,
"thumbnails": true,
"alerts": true,
"progress-bars": true,
"media": true,
"list-group": true,
"panels": true,
"wells": true,
"close": true,
"modals": true,
"tooltip": true,
"popovers": true,
"carousel": true,
"utilities": true,
"responsive-utilities": true
}
};
@@ -0,0 +1 @@
@import "less/style.less";
@@ -0,0 +1,73 @@
// Walkhub
// Copyright (C) 2015 Pronovix
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"encoding/hex"
"log"
"runtime"
"github.com/Pronovix/walkhub-service"
"github.com/spf13/viper"
"github.com/tamasd/ab"
"github.com/tamasd/ab/services/auth"
"github.com/tamasd/ab/util"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
viper.SetConfigName("config")
viper.AddConfigPath(".")
viper.AutomaticEnv()
viper.ReadInConfig()
secret, err := hex.DecodeString(viper.GetString("secret"))
if err != nil {
log.Println(err)
}
cookieSecret, err := hex.DecodeString(viper.GetString("cookiesecret"))
if err != nil {
log.Println(err)
}
cfg := ab.ServerConfig{
PGConnectString: viper.GetString("db"),
CookiePrefix: "WALKHUB",
CookieSecret: cookieSecret,
DevelopmentMode: viper.GetBool("debug"),
}
util.SetKey(secret)
s := walkhub.NewServer(cfg)
s.BaseURL = viper.GetString("baseurl")
s.AuthCreds.Google = auth.OAuthCredentials{
ID: viper.GetString("google.id"),
Secret: viper.GetString("google.secret"),
}
host := viper.GetString("HOST")
if host == "" {
host = "localhost"
}
port := viper.GetString("PORT")
if port == "" {
port = "8080"
}
s.Start(host+":"+port, viper.GetString("certfile"), viper.GetString("keyfile"))
}
@@ -0,0 +1,74 @@
// Walkhub
// Copyright (C) 2015 Pronovix
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/cookiejar"
)
var (
port = flag.Uint("port", 80, "")
https = flag.Bool("https", false, "")
)
var base string
func main() {
flag.Parse()
scheme := "http"
if *https {
scheme = "https"
}
base = fmt.Sprintf("%s://127.0.0.1:%d", scheme, *port)
http.DefaultClient.Jar, _ = cookiejar.New(nil)
token := getToken()
req, _ := http.NewRequest("POST", base+"/api/reindexwalkthroughs", nil)
req.Header.Set("X-CSRF-Token", token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatalln(err)
}
if resp.StatusCode != http.StatusAccepted {
log.Fatalln("Invalid status code: %d", resp.StatusCode)
}
}
func getToken() string {
req, _ := http.NewRequest("GET", base+"/api/token", nil)
req.Header.Add("Accept", "text/plain")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatalln(err)
}
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
return string(b)
}
@@ -0,0 +1,11 @@
{
"db": "",
"debug": true,
"secret": "",
"cookiesecret": "",
"baseurl": "http://localhost:8080/",
"google": {
"id": "",
"secret": ""
}
}
@@ -0,0 +1,11 @@
web:
image: pronovix/walkhub-service
ports:
- "80:80"
links:
- db
db:
image: postgres:latest
environment:
POSTGRES_PASSWORD: docker
POSTGRES_USER: docker
@@ -0,0 +1,47 @@
// Walkhub
// Copyright (C) 2015 Pronovix
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package walkhub
import (
"errors"
"net/http"
"time"
)
//go:generate ab --output=embedloggen.go --generate-service-struct-name=EmbedLogService --generate-crud-update=false --generate-crud-delete=false --generate-service-list=false --generate-service-get=false --generate-service-put=false --generate-service-patch=false --generate-service-delete=false entity EmbedLog
type EmbedLog struct {
UUID string `dbtype:"uuid" dbdefault:"uuid_generate_v4()" json:"uuid"`
IPAddr string `json:"ip"`
Created time.Time `json:"created"`
Site string `json:"site"`
Mail string `json:"mail"`
}
func validateEmbedLog(e *EmbedLog) (err error) {
if e.Site == "" {
return errors.New("site is empty")
}
return nil
}
func embedlogPostValidation(r *http.Request, entity *EmbedLog) {
entity.UUID = ""
entity.Created = time.Now()
entity.IPAddr = r.RemoteAddr
}
Oops, something went wrong.

0 comments on commit b79b6cf

Please sign in to comment.