first spec

This commit is contained in:
samuel 2023-01-31 18:39:59 +01:00
parent abdd3909ee
commit 6fa7cade9d
11 changed files with 226 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
.idea
*.conf

48
Makefile Normal file
View File

@ -0,0 +1,48 @@
NAME = netoik-home
VERSION = $(shell [ -d ".git" ] && git describe | sed "s/-/./g")
BRANCH = $(shell [ -d ".git" ] && git branch --show-current)
SYSCONFDIR = $(shell rpm --eval "%{_sysconfdir}")
VARDIR = $(shell rpm --eval "%{_var}")
BOOTSTRAP_VERSION = 5.1.3
FONTAWESOME_VERSION = 6.1.1
JQUERY_VERSION = 3.6.0
.PHONY: version
version:
@echo $(VERSION)
.PHONY: tarball
tarball: $(HOME)/rpmbuild/SOURCES/$(NAME)-$(VERSION).tar.gz
$(HOME)/rpmbuild/SOURCES/$(NAME)-%.tar.gz: .
git archive --format=tar.gz --output=$@ --prefix=$(NAME)-$(VERSION)/ --worktree-attributes --verbose $(BRANCH)
.PHONY: install
install:
install -D --target-directory $(DESTDIR)$(SYSCONFDIR)/nginx/conf.d nginx/*.conf
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME) src/*.{html,ico}
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/bootstrap-$(BOOTSTRAP_VERSION) src/assets/bootstrap-$(BOOTSTRAP_VERSION)/*.js
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/css src/assets/css/*.css
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/docs src/assets/docs/*.pdf
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/fontawesome-$(FONTAWESOME_VERSION) src/assets/fontawesome-$(FONTAWESOME_VERSION)/*.{js,css}
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/googleapis src/assets/googleapis/roboto
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/img src/assets/img/*.{png,svg}
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/img/services src/assets/img/services/*.svg
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/jquery-$(JQUERY_VERSION) src/assets/jquery-$(JQUERY_VERSION)/*.js
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/assets/js src/assets/js/*.js
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/share/cg src/share/cg/index.html
install -D --target-directory $(DESTDIR)$(VARDIR)/www/$(NAME)/share/in src/share/in/index.html
.PHONY: bootstrap_version
bootstrap_version:
@echo $(BOOTSTRAP_VERSION)
.PHONY: fontawesome_version
fontawesome_version:
@echo $(FONTAWESOME_VERSION)
.PHONY: jquery_version
jquery_version:
@echo $(JQUERY_VERSION)

62
netoik-home.spec Normal file
View File

@ -0,0 +1,62 @@
Name: netoik-home
Version: %(make version)
Release: 1%{?dist}
Summary: Netoik home page
License: GPLv3
URL: https://www.netoik.io
Source0: %{name}-%{version}.tar.gz
BuildArch: x86_64
BuildRequires: make
Requires: netoik-api
%description
Netoik home page
%prep
%autosetup -v
%install
%make_install
%post
ln --symbolic %{_var}/netoik-api/captcha %{_var}/www/%{name}/assets/img/captcha
%preun
rm %{_var}/www/%{name}/assets/img/captcha
%files
%define bootstrap_version %(make bootstrap_version)
%define fontawesome_version %(make fontawesome_version)
%define jquery_version %(make jquery_version)
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/netoik.io.conf
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/samuel-campos.fr.conf
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/www.netoik.io.conf
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/www.samuel-campos.fr.conf
%attr(755, root, root) %dir %{_var}/www/%{name}
%attr(644, root, root) %{_var}/www/%{name}/*.{html,ico}
%attr(755, root, root) %dir %{_var}/www/%{name}/assets
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/bootstrap-%{bootstrap_version}
%attr(644, root, root) %{_var}/www/%{name}/assets/bootstrap-%{bootstrap_version}/*.js
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/css
%attr(644, root, root) %{_var}/www/%{name}/assets/css/*.css
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/docs
%attr(644, root, root) %{_var}/www/%{name}/assets/docs/*.pdf
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/fontawesome-%{fontawesome_version}
%attr(644, root, root) %{_var}/www/%{name}/assets/fontawesome-%{fontawesome_version}/*.{js,css}
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/googleapis
%attr(644, root, root) %{_var}/www/%{name}/assets/googleapis/roboto
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/img
%attr(644, root, root) %{_var}/www/%{name}/assets/img/*.{png,svg}
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/img/services
%attr(644, root, root) %{_var}/www/%{name}/assets/img/services/*.svg
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/jquery-%(make jquery_version)
%attr(644, root, root) %{_var}/www/%{name}/assets/jquery-%{jquery_version}/*.js
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/js
%attr(644, root, root) %{_var}/www/%{name}/assets/js/*.js
%attr(755, root, root) %dir %{_var}/www/%{name}/share
%attr(755, root, root) %dir %{_var}/www/%{name}/share/cg
%attr(644, root, root) %{_var}/www/%{name}/share/cg/index.html
%attr(755, root, root) %dir %{_var}/www/%{name}/share/in
%attr(644, root, root) %{_var}/www/%{name}/share/in/index.html

29
nginx/netoik.io.conf Normal file
View File

@ -0,0 +1,29 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name netoik.io;
# Configure secure access.
ssl_certificate /etc/letsencrypt/live/netoik.io/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/netoik.io/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Redirect to homepage.
return 301 https://www.netoik.io$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name netoik.io;
# Let access to certbot challenge files.
location /.well-known/acme-challenge/ {
root /var/www/;
}
# Redirect to homepage.
return 301 https://www.netoik.io$request_uri;
}

View File

@ -0,0 +1,29 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name samuel-campos.fr;
# Configure secure access.
ssl_certificate /etc/letsencrypt/live/samuel-campos.fr/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/samuel-campos.fr/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Redirect to homepage.
return 301 https://www.netoik.io$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name samuel-campos.fr;
# Let access to certbot challenge files.
location /.well-known/acme-challenge/ {
root /var/www/;
}
# Redirect to homepage.
return 301 https://www.netoik.io$request_uri;
}

32
nginx/www.netoik.io.conf Normal file
View File

@ -0,0 +1,32 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name www.netoik.io;
root /var/www/netoik-home/;
# Configure secure access.
ssl_certificate /etc/letsencrypt/live/netoik.io/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/netoik.io/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Forbide access to hidden files.
location ~ /\. {
return 404;
}
# Forward api requests to back service.
location /api/ {
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 80;
listen [::]:80;
server_name www.netoik.io;
# Redirect to https.
return 301 https://$host$request_uri;
}

View File

@ -0,0 +1,24 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name www.samuel-campos.fr;
# Configure secure access.
ssl_certificate /etc/letsencrypt/live/samuel-campos.fr/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/samuel-campos.fr/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Redirect to homepage.
return 301 https://www.netoik.io$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name www.samuel-campos.fr;
# Redirect to homepage.
return 301 https://www.netoik.io$request_uri;
}

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -151,7 +151,7 @@ window.addEventListener('load', _ => {
$("#captchaImage").attr("src", "/assets/img/captcha/"+data.id+".png");
$("#captchaId").val(data.id);
}).fail(_ => {
$("#captchaImage").attr("src", "/assets/img/captcha/unavailable.png");
$("#captchaImage").attr("src", "/assets/img/captcha-unavailable.png");
$("#captchaId").val();
});
}

View File

@ -313,7 +313,7 @@
<!-- Captcha image-->
<div>
<span class="d-inline-block">
<img src="/assets/img/captcha/loading.png" alt="captcha error" id="captchaImage">
<img src="/assets/img/captcha-loading.png" alt="captcha error" id="captchaImage">
</span>
<span id="captchaReload" role="button" class="text-primary">
<i class="fas fa-rotate-right"></i>