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.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp committed Jul 13, 2018
2 parents 9837d46 + cbb29b4 commit 9dfb429
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@ docker-compose.yml
mainframe.ini

*.plist
*.rdb
.idea/
6 changes: 3 additions & 3 deletions api/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def list(request, validated=[], *args, **kwargs):
default=F('punishment__is_gagged'),
output_field=BooleanField()),
name=F('namespace'), is_internal=F('is_active'))\
.filter(username__contains=validated['match'])
.filter(username__contains=validated['match']).distinct()

if validated['internal']:
selected = selected.filter(is_internal=validated['internal'])
Expand Down Expand Up @@ -192,7 +192,7 @@ def detailed(request, u=None, s=None, validated={}, *args, **kwargs):
'permissions': [a.content_type.app_label + '.' + a.codename for a in user.user_permissions.all()],
'groups': [str(a) for a in user.groups.all()],
'roles': [],
'has_panel_access': user.is_active,
'is_internal': user.is_active,
'country': None if user.country is None else user.country.code
}

Expand Down Expand Up @@ -357,7 +357,7 @@ def detailed(request, u=None, s=None, validated={}, *args, **kwargs):
m = Membership.objects.get(user=user, role=validated['role'])
m.delete()

for role in validated['role']:
for role in validated['roles']:
m = Membership.objects.get(user=user, role=role)
m.delete()

Expand Down
27 changes: 27 additions & 0 deletions core/migrations/0067_server_slug.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions core/migrations/0068_auto_20180713_0006.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def __str__(self):

class Server(BaseModel):
name = models.CharField(max_length=255)
slug = models.SlugField()

ip = models.GenericIPAddressField()
port = models.IntegerField()
password = models.CharField(max_length=255)
Expand Down
16 changes: 15 additions & 1 deletion core/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from django.utils import timezone
from core.lib.steam import populate
import logging
from core.models import User
from core.models import User, Server
from django.template.defaultfilters import slugify


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -81,3 +82,16 @@ def user_log_handler(sender, instance, raw, using, update_fields, **kwargs):

if iplog:
ip.save()


@receiver(pre_save, sender=Server, weak=False)
def server_slug_handler(sender, instance, raw, using, update_fields, **kwargs):
try:
state = Server.objects.get(id=instance.id)
except Server.DoesNotExist:
state = None

if state and state.name == instance.name:
return

instance.slug = slugify(instance.name)[:50]
Binary file modified dump.rdb
Binary file not shown.
21 changes: 10 additions & 11 deletions interface/static/COMPILED/js/api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions interface/static/js/api.create.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ submit = (mode = '', that) ->
if server != 'all'
data.server = server

window.endpoint.api.users[user].punishment.put(o, {}, data, (err, data) ->
window.endpoint.api.users[user].punishments.put(o, {}, data, (err, data) ->
window.ajax.ban.user(1)
)

Expand Down Expand Up @@ -114,7 +114,7 @@ submit = (mode = '', that) ->
if server != 'all'
data.server = server

window.endpoint.api.users[user].punishment.put(o, {}, data, (err, data) ->
window.endpoint.api.users[user].punishments.put(o, {}, data, (err, data) ->
window.ajax.mutegag.user(1)
return data
)
Expand All @@ -125,7 +125,7 @@ submit = (mode = '', that) ->
server: $('input.server', node)[0].value
kicked: true

window.endpoint.api.users[user].punishment.put(o, {}, data, (err, data) ->
window.endpoint.api.users[user].punishments.put(o, {}, data, (err, data) ->
window.ajax.player.user(1)
return data
)
Expand Down
5 changes: 2 additions & 3 deletions interface/static/js/api.delete.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ remove = (mode = '', that) ->
role = $('input.role', node)[0].value

payload =
reset: true
role: role

endpoint = window.endpoint.api.users[user]
Expand All @@ -27,12 +26,12 @@ remove = (mode = '', that) ->
server = $('input.server', node)[0].value
punishment = $('input.punishment', node)[0].value

endpoint = window.endpoint.api.users[user].punishment[punishment]
endpoint = window.endpoint.api.users[user].punishments[punishment]
when 'mutegag'
user = $('input.user', node)[0].value
punishment = $('input.punishment', node)[0].value

endpoint = window.endpoint.api.users[user].punishment[punishment]
endpoint = window.endpoint.api.users[user].punishments[punishment]
when 'server'
node = that.parentElement.parentElement.parentElement.parentElement
server = $('input.uuid', node)[0].value
Expand Down
2 changes: 1 addition & 1 deletion interface/static/js/api.edit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ save = (mode = '', that) ->
if type.match /gag/
payload.gagged = true

window.endpoint.api.users[user].punishment[punishment].post(o, {}, payload, (err, data) ->)
window.endpoint.api.users[user].punishments[punishment].post(o, {}, payload, (err, data) ->)

when 'server'
node = node.parentElement
Expand Down
2 changes: 2 additions & 0 deletions lib/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def run(self, command):
pass
except RCONTimeoutError:
pass
except Exception:
pass
finally:
self.close()

Expand Down
File renamed without changes.
Binary file not shown.
2 changes: 1 addition & 1 deletion sourcemod/addons/sourcemod/scripting/hawthorne/player.sp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
public void OnClientAuthorized(int client) {
CLIENTS[client] = "";

if (StrEqual(SERVER, "") || IsFakeClient(client)) return;
if (StrEqual(SERVER, "") || IsFakeClient(client) || client < 1) return;

char steamid[20];
GetClientAuthId(client, AuthId_SteamID64, steamid, sizeof(steamid));
Expand Down
2 changes: 1 addition & 1 deletion sourcemod/addons/sourcemod/scripting/hawthorne/server.sp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void GetServerUUID() {
httpClient.Get(url, APIGetServerUUID);
}

public void APIGetServerUUID(HTTPResponse response, any value) {
void APIGetServerUUID(HTTPResponse response, any value) {
if (!APIValidator(response)) return;

JSONObject output = view_as<JSONObject>(response.Data);
Expand Down

0 comments on commit 9dfb429

Please sign in to comment.