Skip to content

Commit b9cb8e0

Browse files
author
Shellcheff
committed
Initial Commit
0 parents  commit b9cb8e0

File tree

19 files changed

+999
-0
lines changed

19 files changed

+999
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
upload/

Dockerfile

Whitespace-only changes.

Makefile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
TIME=$(shell date +"%Y%m%d.%H%M%S")
2+
VERSION=0.1.1-alpha-0.8
3+
BINARY_NAME=go-qplace-api-go.v1
4+
5+
BINARY_NAME_SERVER=go-qplace-api-server.v1
6+
7+
8+
BUILD_FOLDER = $(shell pwd)/build
9+
10+
FLAGS_LINUX = CGO_LDFLAGS="-L./LIB -Wl,-rpath -Wl,\$ORIGIN/LIB" CGO_ENABLED=1 GOOS=linux GOARCH=amd64
11+
FLAGS_DARWIN = OSXCROSS_NO_INCLUDE_PATH_WARNINGS=1 MACOSX_DEPLOYMENT_TARGET=10.6 CC=o64-clang CXX=o64-clang++ CGO_ENABLED=0
12+
FLAGS_FREEBSD = GOOS=freebsd GOARCH=amd64 CGO_ENABLED=1
13+
FLAGS_WINDOWS = GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc CGO_ENABLED=1
14+
15+
GOFLAGS_WINDOWS = -ldflags -H=windowsgui
16+
17+
check-env:
18+
@mkdir -p $(BUILD_FOLDER)/dist/linux/bin
19+
@mkdir -p $(BUILD_FOLDER)/dist/windows/bin
20+
@mkdir -p $(BUILD_FOLDER)/dist/arm/bin
21+
@mkdir -p $(BUILD_FOLDER)/dist/osx/bin
22+
cp -R config $(BUILD_FOLDER)/dist/linux/
23+
cp -R config $(BUILD_FOLDER)/dist/windows/
24+
cp -R config $(BUILD_FOLDER)/dist/arm/
25+
cp -R config $(BUILD_FOLDER)/dist/osx/
26+
cp -R extras $(BUILD_FOLDER)/dist/linux/
27+
28+
29+
30+
## Linting
31+
lint:
32+
@echo "[lint] Running linter on codebase"
33+
@golint ./...
34+
35+
36+
getdeps:
37+
./getDeps.sh
38+
39+
40+
41+
42+
versioning:
43+
./version.sh ${VERSION} ${TIME}
44+
45+
46+
compile/webresources:
47+
cd web/ && go-bindata -nometadata -o statics/bindata.go -pkg=statics -ignore=bindata.go js/*.js statics/index.html statics/css/* statics/css/themes/*/* statics/fonts/* statics/img/* statics/js/*
48+
49+
build/weblayer-linux:
50+
cd cmd/WebServer && ${FLAGS_LINUX} go build -o ${BUILD_FOLDER}/dist/linux/bin/${BINARY_NAME_SERVER} .
51+
52+
53+
run/dev:
54+
cd build/dist/linux && bin/Wanpan --config config/config.json
55+
56+
build/dev: check-env build/weblayer-linux run/dev
57+
58+
clean:
59+
rm -Rvf build/dist/

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# go-qplace-api
2+
3+
API implemetation of ffmpeg callback with workers and async.
4+
5+
6+
### Code
7+
8+
This is the line we need to use to export ... reasonable:
9+
10+
11+
``` bash
12+
13+
ffmpeg -ss 2 -i Export\ Buttons-2019-10-15_14.56.53.mkv -filter_complex "[0:v] fps=8,scale=1024:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" ExportButton.gif
14+
15+
```
16+
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package commands
2+
3+
import (
4+
"fmt"
5+
"log"
6+
"os"
7+
8+
"github.com/spf13/cobra"
9+
10+
models "github.com/jpramirez/go-qplace-api/pkg/models"
11+
12+
"github.com/jpramirez/go-qplace-api/pkg/constants"
13+
utils "github.com/jpramirez/go-qplace-api/pkg/utils"
14+
"github.com/jpramirez/go-qplace-api/web"
15+
)
16+
17+
var rootCmd = &cobra.Command{
18+
Use: "WanPan",
19+
Short: "One Push notification Service",
20+
Long: `A Fast and Flexible on push platform`,
21+
RunE: runWebServer,
22+
}
23+
24+
//Execute will run the desire module command.
25+
func Execute() {
26+
if err := rootCmd.Execute(); err != nil {
27+
fmt.Println(err)
28+
os.Exit(1)
29+
}
30+
}
31+
32+
var config models.Config
33+
var cfgFile string
34+
var projectBase string
35+
var monitorMode string
36+
37+
func init() {
38+
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./config/config.json)")
39+
rootCmd.PersistentFlags().Bool("default", true, "Use default configuration")
40+
}
41+
42+
func runWebServer(cmd *cobra.Command, args []string) error {
43+
config, err := utils.LoadConfiguration(cfgFile)
44+
if err != nil {
45+
log.Fatalln("Error and Exiting")
46+
}
47+
f, err := os.OpenFile(config.LogFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
48+
fmt.Println(config.LogFile)
49+
if err != nil {
50+
log.Fatalf("error opening file: %v", err)
51+
}
52+
defer f.Close()
53+
log.SetOutput(f)
54+
55+
webagent, err := web.NewWebAgent(config, constants.BuildVersion, constants.BuildTime)
56+
if err != nil {
57+
log.Fatalln("Error on newebagent call ", err)
58+
}
59+
webagent.StartServer()
60+
return err
61+
}

cmd/WebServer/main.go

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import (
4+
"github.com/jpramirez/go-qplace-api/cmd/WebServer/commands"
5+
)
6+
7+
func main() {
8+
commands.Execute()
9+
}

config/config.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"webport":"5335",
3+
"webaddress":"0.0.0.0",
4+
"appname":"go-qplace-api",
5+
"logfile":"gogif-server.log",
6+
"uploadfolder":"./upload/",
7+
"keyfile":"./extras/ssl/server.key",
8+
"crtfile":"./extras/ssl/server.crt",
9+
"audioformats": ["audio/wave","application/octet-stream","audio/mp4","audio/wav","audio/ogg","audio/vnd.wav","audio/mpeg","audio/mid"]
10+
}

extras/ssl/server.crt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIICRTCCAcqgAwIBAgIUM30S9AiLnK7RbL2KeXHAeTy70dkwCgYIKoZIzj0EAwIw
3+
WTELMAkGA1UEBhMCQVIxCzAJBgNVBAgMAkJBMQ4wDAYDVQQHDAVUaWdyZTEPMA0G
4+
A1UECgwGV2FucGFuMQswCQYDVQQLDAJJVDEPMA0GA1UEAwwGd2FucGFuMB4XDTE5
5+
MTAwODIzMjQ1N1oXDTI5MTAwNTIzMjQ1N1owWTELMAkGA1UEBhMCQVIxCzAJBgNV
6+
BAgMAkJBMQ4wDAYDVQQHDAVUaWdyZTEPMA0GA1UECgwGV2FucGFuMQswCQYDVQQL
7+
DAJJVDEPMA0GA1UEAwwGd2FucGFuMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAENabd
8+
ma8+ikGV5mxULTIIAqc18U7wWWLOWvWiWkTqUXvmSt85e3+iDQNmeO+kJYW+McMl
9+
MO61XSbNh4GO9mZLa6ghaZnFt0b5g2zLvBa7Bck3GFlxmfJ9FrfIeuvlQvvpo1Mw
10+
UTAdBgNVHQ4EFgQUdxbVEkns/++iHkozqCs6WYlasnowHwYDVR0jBBgwFoAUdxbV
11+
Ekns/++iHkozqCs6WYlasnowDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNp
12+
ADBmAjEAtSSkrHeIsEiBw+73ct50bn/Bz5o6V98rzuTG8muN0bER67AMbt0RNQZ+
13+
FfkWpNHzAjEAmfPSGc1verCuO4f2ZuphI93oFwlZmhwHPkTijASH3gbpylBLqVYK
14+
WnOIOsaXvhWz
15+
-----END CERTIFICATE-----

extras/ssl/server.key

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-----BEGIN EC PARAMETERS-----
2+
BgUrgQQAIg==
3+
-----END EC PARAMETERS-----
4+
-----BEGIN EC PRIVATE KEY-----
5+
MIGkAgEBBDAnMjjCLb052ORIujp44kQS/AOz2dA11X9Awx2zg5vUjTMsRO75rqiS
6+
H/KwNJL4BfqgBwYFK4EEACKhZANiAAQ1pt2Zrz6KQZXmbFQtMggCpzXxTvBZYs5a
7+
9aJaROpRe+ZK3zl7f6INA2Z476Qlhb4xwyUw7rVdJs2HgY72ZktrqCFpmcW3RvmD
8+
bMu8FrsFyTcYWXGZ8n0Wt8h66+VC++k=
9+
-----END EC PRIVATE KEY-----

0 commit comments

Comments
 (0)