Compare commits
4 Commits
staging
...
pkg/dev/ub
Author | SHA1 | Date | |
---|---|---|---|
ef4d5efd02 | |||
3020ab96b4 | |||
db7d0c1b36 | |||
4e008108d8 |
@ -6,10 +6,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{block "title" . -}}{{- end}}</title>
|
||||
{{- block "head_style" . -}}
|
||||
<link rel="stylesheet" href="/css/main.css" />
|
||||
<link rel="stylesheet" href="{{ .BaseUrl }}/css/main.css" />
|
||||
{{end}}
|
||||
{{- block "head_script" . -}}
|
||||
<script type="text/javascript" src="/main.js"></script>
|
||||
<script type="text/javascript" src="{{ .BaseUrl }}/main.js"></script>
|
||||
{{end}}
|
||||
</head>
|
||||
<body>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="columns is-mobile">
|
||||
<div class="column is-narrow">
|
||||
<h1 class="is-size-3 title">
|
||||
<a href="/" rel="Inbox" class="has-text-grey-dark">
|
||||
<a href="{{ .BaseUrl }}" rel="Inbox" class="has-text-grey-dark">
|
||||
{{if or .Messages .SMS}}
|
||||
📳
|
||||
{{else}}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{{define "header_buttons"}}
|
||||
<button
|
||||
data-controller="restful"
|
||||
data-restful-endpoint="/sms"
|
||||
data-restful-endpoint="{{ .BaseUrl }}/sms"
|
||||
data-restful-method="DELETE"
|
||||
class="button is-danger">
|
||||
🗑️ Clear
|
||||
@ -26,7 +26,7 @@
|
||||
{{range .Messages}}
|
||||
<tr data-controller="inbox-entry"
|
||||
data-action="click->outbox-entry#onClick"
|
||||
data-inbox-entry-link="./sms/{{ .ID }}">
|
||||
data-inbox-entry-link="{{ .BaseUrl }}/sms/{{ .ID }}">
|
||||
<td class="sms-from">
|
||||
<span class="is-size-7">{{ .From }}</span>
|
||||
</td>
|
||||
@ -38,7 +38,7 @@
|
||||
</td>
|
||||
<td class="sms-actions">
|
||||
<div class="buttons is-right">
|
||||
<a href="./sms/{{ .ID }}" class="button is-small is-link">👁️ See</a>
|
||||
<a href="{{ .BaseUrl }}/sms/{{ .ID }}" class="button is-small is-link">👁️ See</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -2,9 +2,9 @@
|
||||
{{define "header_buttons"}}
|
||||
<button class="button is-danger"
|
||||
data-controller="restful"
|
||||
data-restful-endpoint="./{{ .SMS.ID }}"
|
||||
data-restful-endpoint="{{ .BaseUrl }}/{{ .SMS.ID }}"
|
||||
data-restful-method="DELETE"
|
||||
data-restful-redirect="../">
|
||||
data-restful-redirect="{{ .BaseUrl }}">
|
||||
🗑️ Delete
|
||||
</button>
|
||||
{{end}}
|
||||
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
9
|
14
debian/control
vendored
Normal file
14
debian/control
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
Source: fake-sms
|
||||
Section: unknown
|
||||
Priority: optional
|
||||
Maintainer: Cadoles <contact@cadoles.com>
|
||||
Build-Depends: debhelper (>= 8.0.0), wget, ca-certificates, tar, curl
|
||||
Standards-Version: 3.9.4
|
||||
Homepage: http://forge.cadoles.com/Cadoles/fake-sms
|
||||
Vcs-Git: http://forge.cadoles.com/Cadoles/fake-sms.git
|
||||
Vcs-Browser: http://forge.cadoles.com/Cadoles/fake-sms
|
||||
|
||||
Package: fake-sms
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Serveur d'envoi de SMS factice pour le développement avec interface web
|
1
debian/fake-sms.dirs
vendored
Normal file
1
debian/fake-sms.dirs
vendored
Normal file
@ -0,0 +1 @@
|
||||
var/lib/fake-sms
|
11
debian/fake-sms.service
vendored
Normal file
11
debian/fake-sms.service
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Serveur d'envoi de SMS factice pour le développement avec interface web
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/fake-sms -workdir /usr/share/fake-sms -config /etc/fake-sms/config.yml
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
54
debian/rules
vendored
Normal file
54
debian/rules
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
export DH_VERBOSE=1
|
||||
|
||||
GO_VERSION := 1.15.6
|
||||
OS := linux
|
||||
ARCH := amd64
|
||||
GOPATH=$(HOME)/go
|
||||
|
||||
ifeq (, $(shell which go 2>/dev/null))
|
||||
override_dh_auto_build: install-go
|
||||
endif
|
||||
|
||||
ifeq (, $(shell which node 2>/dev/null))
|
||||
override_dh_auto_build: install-nodejs
|
||||
endif
|
||||
|
||||
%:
|
||||
dh $@ --with systemd
|
||||
|
||||
override_dh_auto_build: $(GOPATH)
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" make tooling
|
||||
npm install
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" go mod vendor
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" ARCH_TARGETS=$(ARCH) make release
|
||||
|
||||
$(GOPATH):
|
||||
mkdir -p $(GOPATH)
|
||||
|
||||
install-go:
|
||||
wget https://dl.google.com/go/go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
||||
tar -C /usr/local -xzf go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
||||
|
||||
install-nodejs:
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
||||
apt-get install -y nodejs
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/fake-sms/usr/share/fake-sms
|
||||
mkdir -p debian/fake-sms/etc/fake-sms
|
||||
mkdir -p debian/fake-sms/usr/bin
|
||||
|
||||
cp -r release/fake-sms-$(OS)-$(ARCH)/* debian/fake-sms/usr/share/fake-sms/
|
||||
|
||||
mv debian/fake-sms/usr/share/fake-sms/bin/fake-sms debian/fake-sms/usr/bin/fake-sms
|
||||
mv debian/fake-sms/usr/share/fake-sms/config.yml debian/fake-sms/etc/fake-sms/config.yml
|
||||
|
||||
install -d debian/fake-sms
|
||||
|
||||
override_dh_strip:
|
||||
|
||||
override_dh_auto_test:
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
||||
3.0 (native)
|
@ -20,6 +20,7 @@ type HTTPConfig struct {
|
||||
Address string `yaml:"address" env:"FAKESMS_HTTP_ADDRESS"`
|
||||
TemplateDir string `yaml:"templateDir" env:"FAKESMS_HTTP_TEMPLATEDIR"`
|
||||
PublicDir string `yaml:"publicDir" env:"FAKESMS_HTTP_PUBLICDIR"`
|
||||
BaseURL string `yaml:"baseUrl" env:"FAKESMS_HTTP_BASEURL"`
|
||||
}
|
||||
|
||||
type DataConfig struct {
|
||||
|
@ -5,9 +5,11 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"forge.cadoles.com/Cadoles/fake-sms/internal/config"
|
||||
"forge.cadoles.com/Cadoles/fake-sms/internal/query"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/middleware/container"
|
||||
"gitlab.com/wpetit/goweb/service"
|
||||
"gitlab.com/wpetit/goweb/service/template"
|
||||
)
|
||||
|
||||
@ -15,6 +17,7 @@ func extendTemplateData(w http.ResponseWriter, r *http.Request, data template.Da
|
||||
ctn := container.Must(r.Context())
|
||||
data, err := template.Extend(data,
|
||||
template.WithBuildInfo(w, r, ctn),
|
||||
withBaseURL(ctn),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
@ -24,6 +27,19 @@ func extendTemplateData(w http.ResponseWriter, r *http.Request, data template.Da
|
||||
return data
|
||||
}
|
||||
|
||||
func withBaseURL(ctn *service.Container) template.DataExtFunc {
|
||||
return func(data template.Data) (template.Data, error) {
|
||||
conf, err := config.From(ctn)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
data["BaseURL"] = conf.HTTP.BaseURL
|
||||
|
||||
return data, nil
|
||||
}
|
||||
}
|
||||
|
||||
func createOutboxQueryFromRequest(r *http.Request) (*query.GetOutboxRequest, error) {
|
||||
orderBy := r.URL.Query().Get("orderBy")
|
||||
reverse := r.URL.Query().Get("reverse")
|
||||
|
Reference in New Issue
Block a user