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.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp committed Jun 15, 2018
2 parents d027080 + 820145c commit b2789b1
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 38 deletions.
6 changes: 3 additions & 3 deletions api/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,6 @@ def detailed(request, u=None, s=None, validated={}, *args, **kwargs):
except Exception as e:
return 'not existent steamid provided - {}'.format(e), 403

if not user.is_active:
return 'user not using panel'

if validated['purge']:
if user.is_superuser:
return 'superuser cannot be removed', 403
Expand All @@ -309,6 +306,9 @@ def detailed(request, u=None, s=None, validated={}, *args, **kwargs):
m = Membership.objects.get(user=user, role=validated['role'])
m.delete()
else:
if not user.is_active:
return 'user not using panel', 403

if user.is_superuser:
return 'superuser cannot be deactivated', 403

Expand Down
5 changes: 3 additions & 2 deletions cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ install() {

hash git >/dev/null 2>&1 || {
printf "${YELLOW}Git not preinstalled. Reinstalling...${NORMAL}\n"
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
yum -y install git
}

Expand Down Expand Up @@ -378,8 +379,8 @@ configure() {
while true; do
read -p "Is your webserver ${BOLD}(A)${NORMAL}pache, ${BOLD}(N)${NORMAL}ginx or ${BOLD}(D)${NORMAL}ifferent? " yn
case $yn in
[Aa]* ) web="apache"
sed -i "s#bind = 'unix:/tmp/sockets/hawthorne.sock'#bind = '127.0.0.1:8000'#g" $directory/gunicorn.conf.py
[Aa]* ) sed -i "s#bind = 'unix:/tmp/sockets/hawthorne.sock'#bind = '127.0.0.1:8000'#g" $directory/gunicorn.conf.py
web="apache"
break;;
[Nn]* ) break;;
[Dd]* ) web="unspecified"
Expand Down
10 changes: 5 additions & 5 deletions cli/toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ update () {
git pull

printf "${GREEN}Checking dependencies and updating components.\n${NORMAL}"
pip3 install -r requirements.txt
pip3 install -U -r requirements.txt
python3 manage.py migrate
python3 manage.py collectstatic --noinput

printf "${GREEN}Recreating permissions.\n${NORMAL}"
cat $dir/cli/utils/permission_delete.py | python3 manage.py shell
echo "ALTER TABLE auth_permission AUTO_INCREMENT = 1;" | python3 manage.py dbshell
python3 manage.py migrate --run-syncdb
# printf "${GREEN}Recreating permissions.\n${NORMAL}"
# cat $dir/cli/utils/permission_delete.py | python3 manage.py shell
# echo "ALTER TABLE auth_permission AUTO_INCREMENT = 1;" | python3 manage.py dbshell
# python3 manage.py migrate --run-syncdb

hash supervisorctl >/dev/null 2>&1 || {
printf "${YELLOW}Was unable to detect supervisor - not attempting to restart wsgi\n${NORMAL}"
Expand Down
14 changes: 13 additions & 1 deletion docs/changelog/v08.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* **Updated:** SM: blocking native SM calls


# v0.8.5 (2018-05-21)
# v0.8.5 (2018-06-08)
* **Added:** SM: Status command
* **Added:** Auto resolve of Punishments
* **Fixed:** Installation Script
Expand All @@ -54,3 +54,15 @@
* **Updated:** Mute/Gag and Ban are now Punishment (`Backwards incompatible change`)
* **Updated:** SM: Ban command
* **Updated:** Django-Automated-Logging


# v0.8.6 (2018-06-15)
* **Added:** Git 2.0 CentOS support (_thanks to Hexah_)
* **Fixed:** SM: Ban interactive
* **Fixed:** SM: Uppercase roles now works as expected
* **Fixed:** Interface editing dates
* **Fixed:** RCON fallback when not correct response
* **Fixed:** Apache2 sed command in install
* **Updated:** `hawthorne update` now upgrades pip packages
* **Updated:** Mainframe now points to hawthornepanel.org
* **Removed:** Permission reset for `hawthorne update`
12 changes: 6 additions & 6 deletions interface/static/COMPILED/js/api.js

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

1 change: 1 addition & 0 deletions interface/static/js/api.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#= require api.edit.coffee
#= require api.create.coffee


game = (that = null, selected = '') ->
window.endpoint.api.capabilities.games.get((err, data) ->
data = data.result
Expand Down
4 changes: 2 additions & 2 deletions interface/static/js/api.delete.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ remove = (mode = '', that) ->
user = $('input.user', node)[0].value
server = $('input.server', node)[0].value

console.log $('input.user', node)[0]
console.log user
if server == ""
server = null

payload =
server: server
Expand Down
8 changes: 3 additions & 5 deletions interface/static/js/api.edit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ save = (mode = '', that) ->
window.endpoint.api.roles[uuid].post(o, {}, data, (err, data) ->)

when 'mutegag', 'ban'
user = $('input.user')[0].value
server = $('input.server')[0].value

now = new Date()
now = now.getTime() / 1000
user = $('input.user', node)[0].value
server = $('input.server', node)[0].value

now = parseInt($(".icon.time", node)[0].getAttribute("data-created"))
time = $(".icon.time input", node)[0].value

if time != ''
Expand Down
2 changes: 1 addition & 1 deletion interface/templates/partials/ban/user.pug
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
span {% trans "all" %}
- else
span= data.server.name
.column.icon.time.pure-u-7-24
.column.icon.time.pure-u-7-24(data-created='{{data.created_at|date:"U"}}')
i.adjusted(data-feather="clock")
span(data-timestamp='{{data.created_at|add:data.length|date:"U"}}')
if data.length is not None
Expand Down
2 changes: 1 addition & 1 deletion interface/templates/partials/mutegag/user.pug
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
span {% trans "all" %}
.column.icon.time.pure-u-7-24
i.adjusted(data-feather="clock")
span(data-timestamp='{{data.created_at|add:data.length|date:"U"}}')
span(data-timestamp='{{data.created_at|add:data.length|date:"U"}}', data-created='{{data.created_at|date:"U"}}')
if data.length is not None
{% blocktrans with until=data.created_at|add:data.length|date:"SHORT_DATETIME_FORMAT" %}until {{until}}{% endblocktrans %}
else
Expand Down
10 changes: 5 additions & 5 deletions lib/sourcemod.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def ban(self, punishment, *args, **kwargs):

try:
response = self.run(command)[0]
except valve.rcon.RCONError as e:
except (valve.rcon.RCONError, IndexError) as e:
return {'error': e}

return response
Expand All @@ -36,7 +36,7 @@ def kick(self, punishment, *args, **kwargs):
try:
response = self.run('sm_kick {} {}'.format(punishment.user.namespace,
punishment.reason))[0]
except valve.rcon.RCONError as e:
except (valve.rcon.RCONError, IndexError) as e:
return {'error': e}

return response
Expand All @@ -60,7 +60,7 @@ def mutegag(self, punishment, *args, **kwargs):

try:
response = self.run(command)[0]
except valve.rcon.RCONError as e:
except (valve.rcon.RCONError, IndexError) as e:
return {'error': e}

return response
Expand All @@ -80,7 +80,7 @@ def status(self, truncated=False, *args, **kwargs):

response = ''.join(response)
logger.warning(response)
except valve.rcon.RCONError as e:
except (valve.rcon.RCONError, IndexError) as e:
return {'error': e}

response = response.split('\n')[0]
Expand Down Expand Up @@ -125,5 +125,5 @@ def status(self, truncated=False, *args, **kwargs):
def execute(self, command, *args, **kwargs):
try:
return self.run(command)[0]
except valve.rcon.RCONError as e:
except (valve.rcon.RCONError, IndexError) as e:
return {'error': e}
2 changes: 1 addition & 1 deletion panel/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@
'exclude': {'model': ['automated_logging', 'Session', 'basehttp', 'django.server']}
}

MAINFRAME = "hawthorne.in"
MAINFRAME = "hawthornepanel.org"
9 changes: 9 additions & 0 deletions sourcemod/addons/sourcemod/configs/hawthorne/reasons/ban.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Aim Assistance
Wall Assistance
Other Assistance
Multiple Hacks
Mic/Chat Spamming
Inappropriate Name
Inappropriate Language
Ignoring Staff
Other Reason
Binary file modified sourcemod/addons/sourcemod/plugins/hawthorne.smx
Binary file not shown.
8 changes: 4 additions & 4 deletions sourcemod/addons/sourcemod/scripting/hawthorne/admin.sp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ void APIAdminCheck(HTTPResponse response, any value) {
ReplaceString(formatting, sizeof(formatting), "{R}", ht_tag[client]);

if (StrContains(formatting, "{L}")) {
for (int n = 0; n < strlen(endpoint); n++) {
formatting[n] = CharToLower(formatting[n]);
for (int n = 0; n < strlen(ht_tag[client]); n++) {
ht_tag[client][n] = CharToLower(ht_tag[client][n]);
}
ReplaceString(formatting, sizeof(formatting), "{L}", ht_tag[client]);
}

if (StrContains(formatting, "{U}")) {
for (int n = 0; n < strlen(endpoint); n++) {
formatting[n] = CharToUpper(formatting[n]);
for (int n = 0; n < strlen(ht_tag[client]); n++) {
ht_tag[client][n] = CharToUpper(ht_tag[client][n]);
}
ReplaceString(formatting, sizeof(formatting), "{U}", ht_tag[client]);
}
Expand Down
2 changes: 2 additions & 0 deletions sourcemod/addons/sourcemod/scripting/hawthorne/punish.sp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
void Punishment_OnPluginStart() {
BuildPath(Path_SM, PUNISHMENT_TIMES, sizeof(PUNISHMENT_TIMES), "configs/hawthorne/punishment.txt");
BuildPath(Path_SM, BAN_REASONS, sizeof(BAN_REASONS), "configs/hawthorne/reasons/ban.txt");
BuildPath(Path_SM, GAG_REASONS, sizeof(GAG_REASONS), "configs/hawthorne/reasons/gag.txt");
BuildPath(Path_SM, MUTE_REASONS, sizeof(MUTE_REASONS), "configs/hawthorne/reasons/mute.txt");
BuildPath(Path_SM, SILENCE_REASONS, sizeof(SILENCE_REASONS), "configs/hawthorne/reasons/silence.txt");
Expand Down Expand Up @@ -280,6 +281,7 @@ public int MenuHandlerDuration(Menu menu, MenuAction action, int client, int par
if (mode == ACTION_UNSILENCE || mode == ACTION_SILENCE) PopulateMenuWithConfig(reason, SILENCE_REASONS);
if (mode == ACTION_UNMUTE || mode == ACTION_MUTE) PopulateMenuWithConfig(reason, MUTE_REASONS);
if (mode == ACTION_UNGAG || mode == ACTION_GAG) PopulateMenuWithConfig(reason, GAG_REASONS);
if (mode == ACTION_UNBAN || mode == ACTION_BAN) PopulateMenuWithConfig(reason, BAN_REASONS);

reason.ExitButton = true;
reason.Display(client, 20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define CONFLICT_CONVERT 3
#define CONFLICT_ABORT 4

#define MAX_REASONS 8
#define MAX_REASONS 16


HTTPClient httpClient;
Expand Down Expand Up @@ -54,8 +54,8 @@ char endpoint[512];

char SERVER_HOSTNAME[512],
GAG_REASONS[PLATFORM_MAX_PATH],
BAN_REASONS[PLATFORM_MAX_PATH],
MUTE_REASONS[PLATFORM_MAX_PATH],

SILENCE_REASONS[PLATFORM_MAX_PATH],
PUNISHMENT_TIMES[PLATFORM_MAX_PATH];

Expand Down

0 comments on commit b2789b1

Please sign in to comment.