WIP templates

This commit is contained in:
Quentin Dufour 2023-04-18 19:37:51 +02:00
parent 02670ba6a6
commit 37b7694910
No known key found for this signature in database
GPG Key ID: E9602264D639FF68
12 changed files with 373 additions and 24 deletions

View File

@ -2,30 +2,30 @@
"http_bind_addr": ":9991",
"ldap_server_addr": "ldap://127.0.0.1:389",
"base_dn": "dc=example,dc=com",
"user_base_dn": "ou=users,dc=example,dc=com",
"base_dn": "dc=bottin,dc=eu",
"user_base_dn": "ou=users,dc=bottin,dc=eu",
"user_name_attr": "cn",
"group_base_dn": "ou=groups,dc=example,dc=com",
"group_base_dn": "ou=groups,dc=bottin,dc=eu",
"group_name_attr": "cn",
"invitation_base_dn": "ou=invitations,dc=example,dc=com",
"invitation_base_dn": "ou=invitations,dc=bottin,dc=eu",
"invitation_name_attr": "cn",
"invited_mail_format": "{}@example.com",
"invited_auto_groups": [
"cn=email,ou=groups,dc=example,dc=com"
"cn=email,ou=groups,dc=bottin,dc=eu"
],
"web_address": "https://guichet.example.com",
"web_address": "http://guichet.localhost:9991",
"mail_from": "welcome@example.com",
"smtp_server": "smtp.example.com",
"smtp_username": "guichet",
"smtp_password": "",
"admin_account": "cn=admin,dc=example,dc=com",
"group_can_admin": "gid=admin,ou=groups,dc=example,dc=com",
"admin_account": "cn=admin,dc=bottin,dc=eu",
"group_can_admin": "gid=admin,ou=groups,dc=bottin,dc=eu",
"group_can_invite": "",
"s3_endpoint": "garage.example.com",
"s3_endpoint": "localhost",
"s3_access_key": "",
"s3_secret_key": "",
"s3_region": "garage",

26
garage.go Normal file
View File

@ -0,0 +1,26 @@
package main
import (
"net/http"
)
func handleGarageKey(w http.ResponseWriter, r *http.Request) {
tKey := getTemplate("garage_key.html")
tKey.Execute(w, nil)
}
func handleGarageWebsiteList(w http.ResponseWriter, r *http.Request) {
tWebsiteList := getTemplate("garage_website_list.html")
tWebsiteList.Execute(w, nil)
}
func handleGarageWebsiteNew(w http.ResponseWriter, r *http.Request) {
tWebsiteNew := getTemplate("garage_website_new.html")
tWebsiteNew.Execute(w, nil)
}
func handleGarageWebsiteInspect(w http.ResponseWriter, r *http.Request) {
tWebsiteInspect := getTemplate("garage_website_inspect.html")
tWebsiteInspect.Execute(w, nil)
}

View File

@ -0,0 +1,26 @@
metadata_dir = "/tmp/meta"
data_dir = "/tmp/data"
db_engine = "lmdb"
replication_mode = "none"
rpc_bind_addr = "[::]:3901"
rpc_public_addr = "127.0.0.1:3901"
rpc_secret = "93086c2378eecea1cc9e83ee0554a8c510359215168774a396dcb5a01f88dd79"
[s3_api]
s3_region = "garage"
api_bind_addr = "[::]:3900"
root_domain = ".s3.garage.localhost"
[s3_web]
bind_addr = "[::]:3902"
root_domain = ".web.garage.localhost"
index = "index.html"
[k2v_api]
api_bind_addr = "[::]:3904"
[admin]
api_bind_addr = "0.0.0.0:3903"
admin_token = "GlXP43PWH3LuvEGSNxKYzZCyUss8VqZmarBU+HUlrxw="

View File

@ -14,3 +14,12 @@ services:
- "389:389"
volumes:
- "./config/bottin.json:/etc/bottin.json"
garage:
image: dxflrs/garage:v0.8.2
ports:
- "3900:3900"
- "3902:3902"
- "3903:3903"
- "3904:3904"
volumes:
- "./config/garage.toml:/etc/garage.toml"

View File

@ -129,6 +129,11 @@ func main() {
r.HandleFunc("/directory/search", handleDirectorySearch)
r.HandleFunc("/directory", handleDirectory)
r.HandleFunc("/garage/key", handleGarageKey)
r.HandleFunc("/garage/website", handleGarageWebsiteList)
r.HandleFunc("/garage/website/new", handleGarageWebsiteNew)
r.HandleFunc("/garage/website/b/{bucket}", handleGarageWebsiteInspect)
r.HandleFunc("/invite/new_account", handleInviteNewAccount)
r.HandleFunc("/invite/send_code", handleInviteSendCode)
r.HandleFunc("/invitation/{code}", handleInvitationCode)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
static/javascript/jquery.slim.min.js vendored Normal file

File diff suppressed because one or more lines are too long

234
templates/garage_key.html Normal file
View File

@ -0,0 +1,234 @@
{{define "title"}}Profile |{{end}}
{{define "body"}}
<div class="d-flex">
<h4>Mes identifiants</h4>
<a class="ml-auto btn btn-success" href="/garage/website">Mes sites webs</a>
<a class="ml-4 btn btn-info" href="/">Menu principal</a>
</div>
<ul class="nav nav-tabs" id="proto" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="s3-tab" data-toggle="tab" href="#s3" role="tab" aria-controls="s3" aria-selected="true">S3</a>
</li>
<li class="nav-item">
<a class="nav-link" id="sftp-tab" data-toggle="tab" href="#sftp" role="tab" aria-controls="sftp" aria-selected="false">SFTP</a>
</li>
</ul>
<div class="tab-content" id="protocols">
<div class="tab-pane fade show active" id="s3" role="tabpanel" aria-labelledby="s3-tab">
<table class="table mt-4">
<tbody>
<tr>
<th scope="row">Identifiant de clé</th>
<td>GKxxx</td>
</tr>
<tr>
<th scope="row">Clé secrète</th>
<td>...</td>
</tr>
<tr>
<th scope="row">Région</th>
<td>garage</td>
</tr>
<tr>
<th scope="row">Endpoint URL</th>
<td>https://garage.deuxfleurs.fr</td>
</tr>
<tr>
<th scope="row">Type d'URL</th>
<td>DNS et chemin (préférer chemin)</td>
</tr>
<tr>
<th scope="row">Signature</th>
<td>Version 4</td>
</tr>
</tbody>
</table>
<p>Configurer votre logiciel :</p>
<div class="accordion" id="softconfig">
<div class="card">
<div class="card-header" id="awscli-title">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#awscli" aria-expanded="false" aria-controls="awscli">
awscli
</button>
</h2>
</div>
<div id="awscli" class="collapse show" aria-labelledby="awscli-title" data-parent="#softconfig">
<div class="card-body">
<p>Créez un fichier nommé <code>~/.awsrc</code> :</p>
<pre>
export AWS_ACCESS_KEY_ID=GK...
export AWS_SECRET_ACCESS_KEY=...
export AWS_DEFAULT_REGION='garage'
function aws { command aws --endpoint-url https://garage.deuxfleurs.fr $@ ; }
aws --version
</pre>
<p>Ensuite vous pouvez utiliser awscli :</p>
<pre>
source ~/.awsrc
aws s3 ls
aws s3 ls s3://my-bucket
aws s3 cp /tmp/a.txt s3://my-bucket
...
</pre>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="minio-title">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#minio" aria-expanded="true" aria-controls="minio">
Minio CLI
</button>
</h2>
</div>
<div id="minio" class="collapse" aria-labelledby="minio-title" data-parent="#softconfig">
<div class="card-body">
<p>Vous pouvez configurer Minio CLI avec cette commande :</p>
<pre>
mc alias set \
garage \
https://garage.deuxfleurs.fr \
GK... \
... \
--api S3v4
</pre>
<p>Et ensuite pour utiliser Minio CLI avec :</p>
<pre>
mc ls garage/
mc cp /tmp/a.txt garage/my-bucket/a.txt
...
</pre>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="winscp-title">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#winscp" aria-expanded="true" aria-controls="winscp">
WinSCP
</button>
</h2>
</div>
<div id="winscp" class="collapse" aria-labelledby="winscp-title" data-parent="#softconfig">
<div class="card-body">
Reportez vous <a href="">au guide</a>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="hugo-title">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#hugo" aria-expanded="false" aria-controls="hugo">
Hugo
</button>
</h2>
</div>
<div id="hugo" class="collapse" aria-labelledby="hugo-title" data-parent="#softconfig">
<div class="card-body">
<p>Dans votre fichier <code>config.toml</code>, rajoutez :</p>
<pre>
[[deployment.targets]]
URL = "s3://bucket?endpoint=garage.deuxfleurs.fr&amp;s3ForcePathStyle=true&amp;region=garage"
</pre>
<p>Assurez-vous d'avoir un fichier dans lequel les variables <code>AWS_ACCESS_KEY_ID</code> et <code>AWS_SECRET_ACCESS_KEY</code> sont définies,
ici on suppose que vous avez suivi les instructions de l'outil awscli (ci-dessus) et que vous avez un fichier <code>~/.awsrc</code> qui défini ces variables.
Ensuite : </p>
<pre>
source ~/.awsrc
hugo deploy
</pre>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="publii-title">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#publii" aria-expanded="false" aria-controls="publii">
Publii
</button>
</h2>
</div>
<div id="publii" class="collapse" aria-labelledby="publii-title" data-parent="#softconfig">
<div class="card-body">
<em>Bientôt...</em>
</div>
</div>
</div>
</div>
</div>
<!-- sftp -->
<div class="tab-pane fade" id="sftp" role="tabpanel" aria-labelledby="sftp-tab">
<table class="table mt-4">
<tbody>
<tr>
<th scope="row">Nom d'utilisateur-ice</th>
<td>(votre username guichet)</td>
</tr>
<tr>
<th scope="row">Mot de passe</th>
<td>(votre mot de passe guichet)</td>
</tr>
<tr>
<th scope="row">Hôte</th>
<td>sftp://bagage.deuxfleurs.fr</td>
</tr>
<tr>
<th scope="row">Port</th>
<td>2222</td>
</tr>
</tbody>
</table>
<p>Configurer votre logiciel :</p>
<div class="accordion" id="softconfig2">
<div class="card">
<div class="card-header" id="filezilla-title">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#filezilla" aria-expanded="false" aria-controls="filezilla">
scp
</button>
</h2>
</div>
<div id="filezilla" class="collapse show" aria-labelledby="filezilla-title" data-parent="#softconfig">
<div class="card-body">
<p>Un exemple avec SCP :</p>
<pre>
scp -oHostKeyAlgorithms=+ssh-rsa -P2222 -r ./public bagage.deuxfleurs.fr:mon_bucket/
</pre>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="filezilla-title">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#filezilla" aria-expanded="false" aria-controls="filezilla">
Filezilla
</button>
</h2>
</div>
<div id="filezilla" class="collapse" aria-labelledby="filezilla-title" data-parent="#softconfig">
<div class="card-body">
<em>Bientôt</em>
</div>
</div>
</div>
</div>
</div>
</div>
{{end}}

View File

@ -0,0 +1,25 @@
{{define "title"}}Sites webs |{{end}}
{{define "body"}}
<div class="d-flex">
<h4>Sites webs</h4>
<a class="ml-auto btn btn-success" href="/garage/website/new">Nouveau site web</a>
<a class="ml-4 btn btn-info" href="/">Menu principal</a>
</div>
<table class="table mt-4">
<thead>
<th scope="col">ID</th>
<th scope="col">URLs</th>
</thead>
<tbody>
<tr>
<td>
<a href="/garage/website/b/aa">aa</a>
</td>
<td>aa</td>
</tr>
</tbody>
</table>
{{end}}

View File

@ -7,9 +7,9 @@
<div class="d-flex">
<a class="ml-auto btn btn-sm btn-dark" href="/logout">Se déconnecter</a>
</div>
<div class="mt-3"></div>
<div class="card">
<div class="mt-3">
<div class="card">
<div class="card-header">
Mon compte
</div>
@ -18,6 +18,19 @@
<a class="list-group-item list-group-item-action" href="/passwd">Modifier mon mot de passe</a>
<a class="list-group-item list-group-item-action" href="/directory">Annuaire</a>
</div>
</div>
</div>
<div class="mt-3">
<div class="card">
<div class="card-header">
Garage
</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action" href="/garage/key">Mes identifiants</a>
<a class="list-group-item list-group-item-action" href="/garage/website">Mes sites webs</a>
</div>
</div>
</div>
{{if .Login.CanInvite}}

View File

@ -14,5 +14,7 @@
<hr />
{{template "body" .}}
</div>
<script src="/static/javascript/jquery.slim.min.js"></script>
<script src="/static/javascript/bootstrap.bundle.min.js"></script>
</body>
</html>