Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp committed May 8, 2018
2 parents 9a1be5e + 2c033a9 commit 08e236b
Show file tree
Hide file tree
Showing 57 changed files with 3,498 additions and 1,839 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ Hawthorne is a project aimed to provide an easy and modern way to interact with
0.x.x is the beta version, while beginning from 1.x.x a full release is planned.

The current version is **v0.7.4**. This is an unstable beta release.
The current version is **v0.8.0**. This is an unstable beta release.

## Functionality & Features
* Handcrafted, modern, responsive and user friendly UI
* Bans
* Mute & Gags (_ETA v0.8_)
* Mute & Gags
* Extensive logs
* Internal and gameserver wide announcements (_ETA v0.9_)
* Public accesible, configurable page
* Public accesible, configurable page (_ETA v0.11_)
* Rich settings and 120+ permissions
* Mature API and webhooks
* Discord integration (_ETA v0.10_)
* Reports (_ETA v0.10_)
* Intuitive & Secure
* Direct Sourcemod integration

Expand Down
6 changes: 3 additions & 3 deletions ajax/views/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

def status(server, *args, **kwargs):
query = UserOnlineTime.objects.filter(server=server) \
.annotate(date=Cast('disconnected', DateField()))
.annotate(date=Cast('disconnected', DateField()))

last30 = query.filter(date__gte=datetime.date.today() - datetime.timedelta(days=30))
online = last30.values('date') \
.annotate(active=Count('user', distinct=True)) \
.order_by('date')
.annotate(active=Count('user', distinct=True)) \
.order_by('date')

recent = last30.values('server').annotate(active=Count('user', distinct=True))
alltime = query.values('server').annotate(active=Count('user', distinct=True))
Expand Down
16 changes: 8 additions & 8 deletions api/specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
'has_panel_access': {'type': 'boolean', 'default': None, 'nullable': True},
'role': {'type': 'uuid', 'default': None, 'nullable': True}},
'permission': ['core.view_user']},
'PUT': {'parameters': {'steamid': {'type': 'integer', 'min': 76561197960265729, 'max': 76561202255233023, 'dependencies': {'id': None}, 'nullable': True,
'default': None},
'id': {'type': 'uuid', 'dependencies': {'steamid': None}, 'nullable': True,
'default': None},
'PUT': {'parameters': {'steamid': {'type': 'integer', 'min': 76561197960265729, 'max': 76561202255233023, 'excludes': ['id']},
'id': {'type': 'uuid', 'excludes': ['steamid']},

'username': {'type': 'string', 'required': False},
'ip': {'type': 'ip', 'nullable': True, 'default': None},
Expand Down Expand Up @@ -59,9 +57,10 @@
'PUT': {'parameters': {'server': {'type': 'uuid', 'required': False},
'reason': {'type': 'string', 'required': True},
'length': {'type': 'integer', 'required': True},
'issuer': {'type': 'integer', 'default': None, 'nullable': True, 'required': False}},
'issuer': {'type': 'integer', 'default': None, 'nullable': True, 'required': False},
'plugin': {'type': 'boolean', 'default': True}},
'permission': ['core.add_ban']},
'DELETE': {'parameters': {'server': {'type': 'uuid', 'required': True}},
'DELETE': {'parameters': {'server': {'type': 'uuid', 'nullable': True, 'default': None}},
'permission': ['core.delete_ban']},
},
'kick': {
Expand All @@ -87,9 +86,10 @@
'reason': {'type': 'string', 'required': True},
'type': {'type': 'string', 'allowed': ['mute', 'gag', 'both'], 'default': 'both',
'coerce': utils.lower},
'length': {'type': 'integer', 'required': True}},
'length': {'type': 'integer', 'required': True},
'plugin': {'type': 'boolean', 'default': True}},
'permission': ['core.add_mutegag']},
'DELETE': {'parameters': {'server': {'type': 'uuid', 'required': True}},
'DELETE': {'parameters': {'server': {'type': 'uuid', 'nullable': True, 'default': None}},
'permission': ['core.delete_mutegag']},
}
},
Expand Down
4 changes: 2 additions & 2 deletions api/views/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def list(request, validated={}, *args, **kwargs):
except TimeoutError as e:
return _('Could not reach server ({0})').format(e), 500

# we don't want to have a plain one, but we need to. RCON does not hash pwds
# we don't want to have a plain password, but we need to. RCON does not hash pwds
server.password = validated['password']
if 'mode' in validated:
server.mode = validated['mode']
Expand Down Expand Up @@ -97,7 +97,7 @@ def detailed(request, validated={}, s=None, *args, **kwargs):
try:
ip = socket.gethostbyname(validated['ip'])
except socket.gaierror as e:
return 'Could not resolve host by domain ({})'.format(e), 500
return _('Could not resolve host by domain ({0})').format(e), 500
server.ip = ip

if validated['port'] is not None:
Expand Down
16 changes: 10 additions & 6 deletions api/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def list(request, validated=[], *args, **kwargs):
elif request.method == 'PUT':
update = False

if validated['steamid'] is not None:
if 'steamid' in validated:
try:
user = User.objects.get(username=str(validated['steamid']))
update = True
Expand All @@ -57,11 +57,11 @@ def list(request, validated=[], *args, **kwargs):
user.is_active = False
user.is_steam = True

elif validated['id'] is not None:
elif 'id' in validated:
user = User.objects.get(id=validated['id'])
update = True

elif validated['local']:
elif 'local' in validated and validated['local']:
user = User.objects.create_user(username=validated['email'])
user.email = validated['email']
user.is_steam = False
Expand Down Expand Up @@ -470,11 +470,15 @@ def mutegag(request, u=None, validated={}, *args, **kwargs):
if validated['type'] == 'both':
mutegag_type = 'BO'

mutegag = Mutegag(user=user, server=server, reason=validated['reason'], length=length, type=mutegag_type,
created_by=request.user)
mutegag = Mutegag(user=user, server=server, reason=validated['reason'], length=length,
type=mutegag_type, created_by=request.user)
mutegag.save()

SourcemodPluginWrapper(server).mutegag(mutegag)
if validated['plugin']:
server = [server] if server else Server.objects.all()

for s in server:
SourcemodPluginWrapper(s).mutegag(mutegag)

elif request.method == 'DELETE':
server = Server.objects.get(id=validated['server'])
Expand Down
9 changes: 5 additions & 4 deletions cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ install() {

elif hash yum >/dev/null 2>&1; then
yum -y update
yum -y install yum-nginx wget
yum -y install wget
# yum-nginx
yum-builddep python
curl -O https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar xf Python-3.6.4.tgz
Expand Down Expand Up @@ -314,7 +315,7 @@ configure() {
export MYSQL_HOST=$dbhost
export MYSQL_TCP_PORT=$dbport

if mysql -u $dbuser -e "CREATE DATABASE IF NOT EXISTS $dbname"; then
if mysql -u $dbuser -e "CREATE DATABASE IF NOT EXISTS $dbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"; then
printf "\n${GREEN}Successfully connected to database.${NORMAL}\n"
break;
else
Expand Down Expand Up @@ -446,9 +447,9 @@ configure() {
if [ $nginx -ne 2 ]; then
printf "${GREEN}These example configurations have been specificially generated for your system, they might need some tweaking: ${NORMAL}\n\n\n"
if [ "$web" = "nginx" ]; then
printf $(sed "s/server_name example.com;/server_name '$domain';/g" $directory/cli/configs/nginx.example.conf)
sed "s/server_name example.com;/server_name '$domain';/g" $directory/cli/configs/nginx.example.conf
elif [ "$web" = "apache" ]; then
printf $(sed "s/ServerName example.com/ServerName '$domain'/g" $directory/cli/configs/apache.example.conf)
sed "s/ServerName example.com/ServerName '$domain'/g" $directory/cli/configs/apache.example.conf
fi
fi
fi
Expand Down
4 changes: 2 additions & 2 deletions core/decorators/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def wrapper(request, *args, **kwargs):
try:
response = f(request, *args, **kwargs)

if not response:
response = 'success'
if response is None:
response = []
except Exception as e:
response = (e.__str__(), 500)

Expand Down
23 changes: 12 additions & 11 deletions core/management/commands/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class Command(BaseCommand):
help = 'Creates a new report'
help = 'creates a new report sent to the current maintainer'

# https://stackoverflow.com/questions/136168/get-last-n-lines-of-a-file-with-python-similar-to-tail
def tail(self, f, lines=1, _buffer=4098):
Expand Down Expand Up @@ -38,19 +38,20 @@ def handle(self, *args, **options):
traceback = self.tail(log, 100)

payload = {
'path': sys.path,
'version': platform.python_version(),
'system': {x: uname.__getattribute__(x) for x in uname._fields},
'distro': '-'.join(platform.linux_distribution()),
'log': traceback,
'directory': settings.BASE_DIR
'path': sys.path,
'version': platform.python_version(),
'system': {x: uname.__getattribute__(x) for x in uname._fields},
'distro': '-'.join(platform.linux_distribution()),
'log': traceback,
'directory': settings.BASE_DIR
}
response = requests.put("https://{}/api/v1/instance/{}/report".format(settings.MAINFRAME, mainframe().id),
response = requests.put("https://{}/api/v1/instance/{}/report".format(
settings.MAINFRAME, mainframe().id),
json=payload)

print(response.text)
identifier = response.json()['result']['id']

self.stdout.write(self.style.SUCCESS(
'When talking to the maintainer indietyp, please use this ID to identify your ticket:'))
self.stdout.write(self.style.SUCCESS("""
When talking to the maintainer indietyp,
please use this ID to identify your ticket:"""))
self.stdout.write(identifier)
7 changes: 4 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ Hawthorne is a project aimed to provide an easy and modern way to interact with
0.x.x is the beta version, while beginning from 1.x.x a full release is planned.

The current version is **v0.7.4**. This is an unstable beta release.
The current version is **v0.8.0**. This is an unstable beta release.

## Functionality & Features
* Handcrafted, modern, responsive and user friendly UI
* Bans
* Mute & Gags (_ETA v0.8_)
* Mute & Gags
* Extensive logs
* Internal and gameserver wide announcements (_ETA v0.9_)
* Public accesible, configurable page
* Public accesible, configurable page (_ETA v0.11_)
* Rich settings and 120+ permissions
* Mature API and webhooks
* Discord integration (_ETA v0.10_)
* Reports (_ETA v0.10_)
* Intuitive & Secure
* Direct Sourcemod integration

Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo][image-1]

# hawthorne <small>0.7.3</small>
# hawthorne <small>0.8.0</small>

> Just reimagined game server management.
Expand Down
4 changes: 3 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

* **Changelog**
* [v0.7][17]
* [v0.8][18]

[1]: getting-started.md
[2]: toolchain/Quickstart.md
Expand All @@ -42,4 +43,5 @@
[14]: services/Partners.md
[15]: /services/Docker%20Image.md
[16]: services/Manual%20Installation.md
[17]: changelog/v07.md
[17]: changelog/v07.md
[17]: changelog/v08.md
2 changes: 1 addition & 1 deletion docs/changelog/v07.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Changelog of release Marcus Holloway
# Changelog of release "Fanshawe"
# v0.7.0 (2018-04-12)
* *This is the first public release, so basically everything was added so far.*
* **Added:** eastereggs
Expand Down
11 changes: 11 additions & 0 deletions docs/changelog/v08.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog of release "Twice-Told Tales"
# v0.8.0 (2018-05-08)
* **Added:** Mute & Gag support on the plugin
* **Added:** REST-API plugin trigger parameter when `PUT`
* **Added:** CS:GO Windows server support (_Twiz_)
* **Added:** Swedish (100%), Chinese (58%), Pirate English (31%), Russian (13%)
* **Fixed:** Encoding and transformation issue - regarding validation of IP
* **Fixed:** Rendering issue if no data was present (_Twiz_, _Niceday_, _Hexah_)
* **Fixed:** StartUp of SM plugin (_Twiz_, _Hexah_)
* **Fixed:** Usage of cyrillic letters does not crash the application anymore. (_ffnull_)
* **Tested:** SourceMod plugin
6 changes: 3 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sh -c "$(curl -fsSL raw.githubusercontent.com/laevis/hawthorne/master/cli/instal

## Prerequisites
* Web Server (_nginx recommended_)
* MySQL or MariaDB instance (either _local_ or _remote_)
* MySQL 5.7+ or MariaDB 10.2.2+ instance (either _local_ or _remote_)

## Additional information
Because there are several different environments out there, it is not possible to say that it will work on your machine reliably. It was tested on numerous machines and over and over tweaked. If there’s a problem with your configuration, let me know by creating a pull request on [GitHub][1] and/or by contacting [me][2] directly.
Expand All @@ -32,7 +32,6 @@ The current web servers that have been reliably tested are _nginx_ and _Apache 2

Example configurations are provided [here][5].


?> Please pay close attention to the comments provided. That guide you through the process of configuration.

!> **Note:** if nginx is installed over apt(-get), then the config has to be placed in `/etc/nginx/sites-avaiable` *The only thing you should change is the server_name* **Do not change any proxy_\* related things, this will break the configuration.**
Expand All @@ -43,6 +42,7 @@ If the recommended path of the automated installation has been chosen, a pre-con

## Neat things to know
1. 3 Eastereggs are currently hidden
2. The Gunicorn instance is started/stopped/restarted with `supervisorctl start/stop/restart hawthorne`

## Current known system limitations
1. Currently, Hawthorne is unable to run on a subpath like /ht/. It needs to have it’s own _(sub-)domain_.
Expand All @@ -66,7 +66,7 @@ If the recommended path of the automated installation has been chosen, a pre-con

[1]: https://www.github.com/laevis/hawthorne
[2]: mailto:[email protected]?subject=installation
[3]: toolchain.md "More Information"
[3]: toolchain/Quickstart.md "More Information"
[4]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
[5]: https://github.com/laevis/hawthorne/tree/master/cli/configs
[6]: https://stackoverflow.com/a/21627550/9077988
Expand Down
Loading

0 comments on commit 08e236b

Please sign in to comment.