Skip to content

Commit

Permalink
doc++, code cleanup, ready for first release
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtoobii committed Apr 16, 2021
1 parent d7b8e1c commit e82f50b
Show file tree
Hide file tree
Showing 28 changed files with 1,144 additions and 619 deletions.
Binary file added .github/img/create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img/email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Tobias Bossert <tobias.bossert@fastpath.ch>
Tobias Bossert <bossert _at_ oetiker _this_is_a_dot_ ch>
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.0.0 2021-01-12 Tobias Bossert (tobias.bossert@fastpath.ch)
0.1.0 2021-04-16 Tobias Bossert (bossert _at_ oetiker _this_is_a_dot_ ch)
- Initial release

0.0.0 2021-01-12 Tobias Bossert (bossert _at_ oetiker _this_is_a_dot_ ch)
- started project
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SHARE := $(shell test -d share && find -L share -type d -name ".??*" -prune -o -
PERLTESTS := $(shell find -L t -name "*.t")
PM := $(shell find -L lib -name "*.pm")

EXTRA_DIST = VERSION cpanfile COPYRIGHT LICENSE CHANGES AUTHORS bootstrap $(PUB) $(wildcard t/*.t) $(POD) $(TEMPL) $(PERLTESTS) $(SHARE)
EXTRA_DIST = VERSION cpanfile COPYRIGHT LICENSE README.md CHANGES AUTHORS bootstrap $(PUB) $(wildcard t/*.t) $(POD) $(TEMPL) $(PERLTESTS) $(SHARE)

YEAR := $(shell date +%Y)
DATE := $(shell date +%Y-%m-%d)
Expand Down
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
WGwrangler
===========
Version: #VERSION#
Date: #DATE#
Version: 0.1.0
Date: 2021-04-16

WGwrangler is a cool web application
WGwrangler is a web application to manage local Wireguard Configuration using
[wg-meta](https://metacpan.org/release/Wireguard-WGmeta) in its backend.

It comes complete with a classic "configure - make - install" setup.

Expand All @@ -12,6 +13,9 @@ Setup
In your app source directory and start building.

```console
# Install os dependencies
sudo apt install libqrencode-dev

./configure --prefix=$HOME/opt/wgwrangler
make
```
Expand Down Expand Up @@ -67,6 +71,21 @@ setup:
%wireguard_manager ALL=NOPASSWD: /usr/bin/wg*
```
- Set `wireguard_manger` as group on `/etc/wireguard` and adjust permissions to `g+rwx`
- Additionally, creating a `wg-wrangler.service` file may improve usability quite a bit:
```text
# This is to be considered as a (very) simple example of such a .service file
[Unit]
Description=wg-wranger wireguard manager
[Service]
Type=simple
User=wireguard_manager
Group=wireguard_manager
ExecStart=/usr/bin/perl /home/wireguard_manager/opt/wgwrangler/bin/wgwrangler.pl prefork --listen 'http://0.1.0.1:7171'
[Install]
WantedBy=multi-user.target
```

Packaging
---------
Expand All @@ -78,14 +97,24 @@ You can also package the application as a nice tar.gz file, it uses carton to
install dependent module. If you want to make sure that your project builds with perl
5.22, make sure to set the `PERL` environment variable to a perl 5.22
interpreter, make sure to delete any `PERL5LIB` environment variable, and run
`make clean && make`. This will cause a `cpanfile-5.22.1.snapshot` file to be included
`make clean && make`. This will cause a `cpanfile-0.1.0.snapshot` file to be included
with your tar ball, when building the app this snapshot will be used to make sure
all the right versions of the dependent modules get installed.

```console
make dist
```

Screenshots
-----------

![](.github/img/overview.png)

![](.github/img/create.png)

![](.github/img/email.png)


Enjoy!

Tobias Bossert <tobias.bossert@fastpath.ch>
Tobias Bossert <bossert _at_ oetiker _this_is_a_dot_ ch>
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1
0.1.0
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (C) 2021 Tobias Bossert

AC_INIT([wgwrangler],m4_esyscmd([tr -d '\n' < VERSION]),[tobias.bossert@fastpath.ch])
AC_INIT([wgwrangler],m4_esyscmd([tr -d '\n' < VERSION]),[bossert _at_ oetiker _this_is_a_dot_ ch])
AC_PREREQ([2.59])
AC_CONFIG_AUX_DIR(conftools)

Expand Down
2 changes: 1 addition & 1 deletion frontend/Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"authors" : [
{
"name" : "Tobias Bossert",
"email" : "tobias.bossert@fastpath.ch"
"email" : "bossert _at_ oetiker _this_is_a_dot_ ch"
}
],
"version" : "0.0.1"
Expand Down
2 changes: 1 addition & 1 deletion frontend/source/class/wgwrangler/Application.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* ************************************************************************
Copyright: 2021 Tobias Bossert
License: ???
Authors: Tobias Bossert <tobias.bossert@fastpath.ch>
Authors: Tobias Bossert <bossert _at_ oetiker _this_is_a_dot_ ch>
*********************************************************************** */

/**
Expand Down
2 changes: 1 addition & 1 deletion frontend/source/class/wgwrangler/theme/Theme.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* ************************************************************************
Copyright: 2021 Tobias Bossert
License: ???
Authors: Tobias Bossert <tobias.bossert@fastpath.ch>
Authors: Tobias Bossert <bossert _at_ oetiker _this_is_a_dot_ ch>
*********************************************************************** */
qx.Theme.define("wgwrangler.theme.Theme", {
meta : {
Expand Down
83 changes: 53 additions & 30 deletions lib/WGwrangler.pm
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
package WGwrangler;
use Mojo::Base 'CallBackery';
use CallBackery::Model::ConfigJsonSchema;
use WGwrangler::User;
use WGwrangler::Model::WireguardDataAdapter;
use WGwrangler::Model::MailHandler;
use WGwrangler::Model::VersionManager;

=head1 NAME
WGwrangler - the application class
WGwrangler - Main application class
=head1 SYNOPSIS
Expand All @@ -27,12 +19,22 @@ WGwrangler has all the attributes of L<CallBackery> plus:
=cut

=head2 config
=head3 config
use our own plugin directory and our own configuration file:
=cut

package WGwrangler;
use Mojo::Base 'CallBackery';
use CallBackery::Model::ConfigJsonSchema;
use WGwrangler::User;
use WGwrangler::Model::WireguardDataAdapter;
use WGwrangler::Model::MailHandler;
use WGwrangler::Model::VersionManager;

our $VERSION = "0.0.0";

has config => sub {
my $self = shift;
my $config = CallBackery::Model::ConfigJsonSchema->new(
Expand All @@ -58,6 +60,11 @@ has config => sub {
return $config;
};

=head3 database
Database instance (currently only for user management)
=cut
has database => sub {
my $self = shift;
my $database = $self->SUPER::database(@_);
Expand All @@ -68,24 +75,49 @@ has database => sub {
return $database;
};

has 'userObject' => sub {
WGwrangler::User->new();
# has 'userObject' => sub {
# WGwrangler::User->new();
# };


=head3 bgc
Shortcut to $self->config->cfgHash->{BACKEND}.
=cut

has 'bgc' => sub {
my $self = shift;
$self->config->cfgHash->{BACKEND};
};


=head3 wireguardModel
An instance of L<WGwrangler::Model::WireguardDataAdapter>
=cut
has 'wireguardModel' => sub {
my $self = shift;
my $wireguard_home = $self->config->cfgHash->{BACKEND}{wireguard_home};
my $not_applied_suffix = $self->config->cfgHash->{BACKEND}{'not_applied_suffix'};
my $no_apply = $self->config->cfgHash->{BACKEND}{'no_apply'};
WGwrangler::Model::WireguardDataAdapter->new(wireguard_home => $wireguard_home, is_hot_config => $no_apply, app => $self);
WGwrangler::Model::WireguardDataAdapter->new(
wireguard_home => $self->bgc->{wireguard_home},
is_hot_config => $self->bgc->{no_apply},
app => $self,
not_applied_suffix => $self->bgc->{not_applied_suffix}
);
};

=head3 versionManager
An instance of L<WGwrangler::Model::VersionManager>
=cut
has 'versionManager' => sub {
my $self = shift;
my $wireguard_home = $self->config->cfgHash->{BACKEND}{wireguard_home};
my $not_applied_suffix = $self->config->cfgHash->{BACKEND}{'not_applied_suffix'};
my $git_enabled = $self->config->cfgHash->{BACKEND}{'enable_git'};
WGwrangler::Model::VersionManager->new($wireguard_home, $not_applied_suffix, $git_enabled);
WGwrangler::Model::VersionManager->new(
$self->bgc->{wireguard_home},
$self->bgc->{not_applied_suffix},
$self->bgc->{enable_git});
};

1;
Expand All @@ -96,7 +128,7 @@ Copyright (c) 2021 by Tobias Bossert. All rights reserved.
=head1 AUTHOR
S<Tobias Bossert E<lt>tobias.bossert@fastpath.chE<gt>>
S<Tobias Bossert E<lt>bossert _at_ oetiker _this_is_a_dot_ chE<gt>>
=cut

Expand All @@ -106,15 +138,6 @@ __DATA__
-- 1 up
CREATE TABLE song (
song_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
song_title TEXT NOT NULL,
song_voices TEXT,
song_composer TEXT,
song_page INTEGER,
song_note TEXT
);
-- add an extra right for people who can edit
INSERT INTO cbright (cbright_key,cbright_label)
Expand Down
6 changes: 3 additions & 3 deletions lib/WGwrangler/GuiPlugin/CommitMessageForm.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ has formCfg => sub($self) {
label => trm('Commit Message'),
widget => 'textArea',
set => {
placeholder => 'Briefly describe your changes',
placeholder => trm('Briefly describe your changes'),
required => true
}
},
Expand All @@ -86,7 +86,7 @@ has actionCfg => sub {
if($@){
my $error_id = int(rand(100000));
$self->controller->log->error('error_id: ' . $error_id . ' ' . $@);
die mkerror(9999, "Could not checkin new version. Error ID: $error_id");
die mkerror(9999, trm('Could not checkin new version. Error ID: ') . $error_id);
}
return {
action => 'dataSaved',
Expand Down Expand Up @@ -119,7 +119,7 @@ __END__
=head1 AUTHOR
S<Tobias Bossert E<lt>tobias.bossert@fastpath.chE<gt>>
S<Tobias Bossert E<lt>bossert _at_ oetiker _this_is_a_dot_ chE<gt>>
=head1 HISTORY
Expand Down
Loading

0 comments on commit e82f50b

Please sign in to comment.