2020-12-06 20:42:49 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
|
|
|
{% block meta %}
|
|
|
|
{% end %}
|
|
|
|
|
2022-01-20 05:05:14 +00:00
|
|
|
{% block title %}Crafty Controller - {{ translate('panelConfig', 'pageTitle', data['lang']) }}{% end %}
|
2020-12-06 20:42:49 +00:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
2022-04-03 01:25:26 +00:00
|
|
|
<!-- Page Title Header Starts-->
|
2020-12-06 20:42:49 +00:00
|
|
|
<div class="row page-title-header">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="page-header">
|
2023-01-21 11:29:08 +00:00
|
|
|
<h4 class="page-title">
|
|
|
|
{{ translate('panelConfig', 'title', data['lang']) }}
|
|
|
|
<br />
|
|
|
|
</h4>
|
2020-12-06 20:42:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Page Title Header Ends-->
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 grid-margin">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
|
2023-01-21 11:29:08 +00:00
|
|
|
|
|
|
|
{% if data['superuser'] %}
|
2023-02-04 09:50:44 +00:00
|
|
|
<span class="d-none d-sm-block">
|
|
|
|
{% include "parts/crafty_config_list.html %}
|
|
|
|
</span>
|
|
|
|
<span class="d-block d-sm-none">
|
|
|
|
{% include "parts/m_crafty_config_list.html %}
|
|
|
|
</span>
|
2023-01-21 11:29:08 +00:00
|
|
|
{% end %}
|
|
|
|
|
|
|
|
<!-- Page Title Header Starts-->
|
|
|
|
<div class="row page-title-header">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="page-header">
|
|
|
|
<!-- TODO: Translate the following -->
|
|
|
|
<h4 class="page-title">{{ translate('panelConfig', 'pageTitle', data['lang']) }}</h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- Page Title Header Ends-->
|
|
|
|
|
2020-12-06 20:42:49 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
2022-04-03 01:25:26 +00:00
|
|
|
<h4 class="card-title"><i class="fas fa-users"></i> {{ translate('panelConfig', 'users', data['lang'])
|
|
|
|
}}</h4>
|
|
|
|
{% if data['user_data']['hints'] %}
|
2023-01-30 20:23:10 +00:00
|
|
|
<span class="too_small" title="{{ translate('dashboard', 'cannotSee', data['lang']) }}" ,
|
|
|
|
data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}" ,
|
|
|
|
data-placement="top"></span>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% end %}
|
2022-01-15 15:38:08 +00:00
|
|
|
<!-- TODO: Translate the following -->
|
2022-04-03 01:25:26 +00:00
|
|
|
<div><a class="nav-link" href="/panel/add_user"><i class="fas fa-plus-circle"></i> {{
|
|
|
|
translate('panelConfig', 'newUser', data['lang']) }}</a></div>
|
2020-12-06 20:42:49 +00:00
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="table-responsive">
|
2021-08-21 23:41:25 +00:00
|
|
|
<table class="table table-hover">
|
2020-12-06 20:42:49 +00:00
|
|
|
<thead>
|
2022-01-15 15:38:08 +00:00
|
|
|
<!-- TODO: Translate the following -->
|
2020-12-06 20:42:49 +00:00
|
|
|
<tr class="rounded">
|
2022-01-20 05:05:14 +00:00
|
|
|
<th>{{ translate('panelConfig', 'user', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('panelConfig', 'enabled', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('panelConfig', 'allowedServers', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('panelConfig', 'assignedRoles', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('panelConfig', 'edit', data['lang']) }}</th>
|
2020-12-06 20:42:49 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% for user in data['users'] %}
|
2020-12-06 20:42:49 +00:00
|
|
|
<tr>
|
2023-10-09 02:13:55 +00:00
|
|
|
<td><i class="fas fa-user"></i><span id="user_{{user.user_id}}">{{ user.username }}</span></td>
|
2021-10-09 09:10:24 +00:00
|
|
|
<td>
|
2020-12-06 20:42:49 +00:00
|
|
|
{% if user.enabled %}
|
2022-04-03 01:25:26 +00:00
|
|
|
<span class="text-success">
|
|
|
|
<i class="fas fa-check-square"></i> Yes
|
|
|
|
</span>
|
2020-12-06 20:42:49 +00:00
|
|
|
{% else %}
|
2022-04-03 01:25:26 +00:00
|
|
|
<span class="text-danger">
|
|
|
|
<i class="far fa-times-square"></i> No
|
|
|
|
</span>
|
2020-12-06 20:42:49 +00:00
|
|
|
|
|
|
|
{% end %}
|
|
|
|
</td>
|
2021-10-09 09:10:24 +00:00
|
|
|
<td id="server_list_{{user.user_id}}">
|
2022-04-03 01:25:26 +00:00
|
|
|
<ul id="{{user.user_id}}">
|
2021-10-09 09:10:24 +00:00
|
|
|
{% for item in data['auth-servers'][user.user_id] %}
|
2022-04-03 01:25:26 +00:00
|
|
|
<li>{{item}}</li>
|
2021-10-09 09:10:24 +00:00
|
|
|
{% end %}
|
2022-08-19 17:09:59 +00:00
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
<td id="role_list_{{user.user_id}}">
|
|
|
|
<ul>
|
|
|
|
{% for item in data['user-roles'][user.user_id] %}
|
|
|
|
<li data-toggle="tooltip" title="{{ item }}">{{item}}</li>
|
|
|
|
{% end %}
|
|
|
|
</ul>
|
|
|
|
</td>
|
2023-10-09 02:13:55 +00:00
|
|
|
<td><span id="username_{{user.user_id}}" class="edit_user clickable" data-name="{{user.username}}" data-id="{{user.user_id}}"><i class="fa-solid fa-user"></i></span> <span class="edit_password clickable" data-id="{{user.user_id}}"><i class="fa-solid fa-lock"></i></span> <a href="/panel/edit_user?id={{user.user_id}}"><i class="fas fa-pencil-alt"></i></a></td>
|
2022-08-19 17:09:59 +00:00
|
|
|
</tr>
|
|
|
|
{% end %}
|
|
|
|
{% for user in data['managed_users'] %}
|
|
|
|
<tr>
|
|
|
|
<td><i class="fas fa-user"></i> {{ user.username }}</td>
|
|
|
|
<td>
|
|
|
|
{% if user.enabled %}
|
|
|
|
<span class="text-success">
|
|
|
|
<i class="fas fa-check-square"></i> Yes
|
|
|
|
</span>
|
|
|
|
{% else %}
|
|
|
|
<span class="text-danger">
|
|
|
|
<i class="far fa-times-square"></i> No
|
|
|
|
</span>
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
</td>
|
|
|
|
<td id="server_list_{{user.user_id}}">
|
|
|
|
<ul id="{{user.user_id}}">
|
|
|
|
{% for item in data['auth-servers'][user.user_id] %}
|
|
|
|
<li>{{item}}</li>
|
|
|
|
{% end %}
|
2021-10-09 09:10:24 +00:00
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
<td id="role_list_{{user.user_id}}">
|
|
|
|
<ul>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% for item in data['user-roles'][user.user_id] %}
|
2021-10-09 09:10:24 +00:00
|
|
|
<li data-toggle="tooltip" title="{{ item }}">{{item}}</li>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% end %}
|
2021-10-09 09:10:24 +00:00
|
|
|
</ul>
|
|
|
|
</td>
|
2023-10-09 02:13:55 +00:00
|
|
|
<td><span id="username_{{user.user_id}}" class="edit_user clickable" data-name="{{user.username}}" data-id="{{user.user_id}}"><i class="fa-solid fa-user"></i></span> <span class="edit_password clickable" data-id="{{user.user_id}}"><i class="fa-solid fa-lock"></i></span> <a href="/panel/edit_user?id={{user.user_id}}"><i class="fas fa-pencil-alt"></i></a></td>
|
2020-12-06 20:42:49 +00:00
|
|
|
</tr>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% end %}
|
2020-12-06 20:42:49 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2020-12-27 16:00:26 +00:00
|
|
|
</div>
|
2020-12-06 20:42:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-12-27 16:00:26 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
2022-04-03 01:25:26 +00:00
|
|
|
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('panelConfig', 'roles',
|
|
|
|
data['lang']) }}</h4>
|
|
|
|
{% if data['user_data']['hints'] %}
|
2023-01-30 20:23:10 +00:00
|
|
|
<span class="too_small2" title="{{ translate('dashboard', 'cannotSee', data['lang']) }}" ,
|
|
|
|
data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}" ,
|
|
|
|
data-placement="top"></span>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% end %}
|
|
|
|
<div><a class="nav-link" href="/panel/add_role"><i class="fas fa-plus-circle"></i> {{
|
|
|
|
translate('panelConfig', 'newRole', data['lang']) }}</a></div>
|
2020-12-27 16:00:26 +00:00
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="table-responsive">
|
2021-08-21 23:41:25 +00:00
|
|
|
<table class="table table-hover">
|
2020-12-27 16:00:26 +00:00
|
|
|
<thead>
|
2022-01-15 15:38:08 +00:00
|
|
|
<!-- TODO: Translate the following -->
|
2020-12-27 16:00:26 +00:00
|
|
|
<tr class="rounded">
|
2022-01-20 05:05:14 +00:00
|
|
|
<th>{{ translate('panelConfig', 'role', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('panelConfig', 'allowedServers', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('panelConfig', 'roleUsers', data['lang']) }}</th>
|
|
|
|
<th>{{ translate('panelConfig', 'edit', data['lang']) }}</th>
|
2020-12-27 16:00:26 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% for role in data['roles'] %}
|
2020-12-27 16:00:26 +00:00
|
|
|
<tr>
|
|
|
|
<td>{{ role.role_name }}</td>
|
2021-10-09 09:10:24 +00:00
|
|
|
<td id="role_list_{{role.role_id}}">
|
|
|
|
<ul id="{{role.role_id}}">
|
|
|
|
{% for item in data['role-servers'][role.role_id] %}
|
|
|
|
<li>{{item}}</li>
|
|
|
|
{% end %}
|
|
|
|
</ul>
|
|
|
|
</td>
|
2022-04-03 01:25:26 +00:00
|
|
|
<td>
|
|
|
|
<ul>
|
|
|
|
{% for user in data['users'] %}
|
2021-08-09 21:11:45 +00:00
|
|
|
{% for ruser in data['user-roles'][user.user_id] %}
|
2022-04-03 01:25:26 +00:00
|
|
|
{% if ruser == role.role_name %}
|
|
|
|
<li>{{ user.username }}</li>
|
|
|
|
{% end %}
|
|
|
|
{% end %}
|
|
|
|
{% end %}
|
|
|
|
</ul>
|
2021-08-09 21:11:45 +00:00
|
|
|
</td>
|
2020-12-27 16:00:26 +00:00
|
|
|
<td><a href="/panel/edit_role?id={{role.role_id}}"><i class="fas fa-pencil-alt"></i></a></td>
|
|
|
|
</tr>
|
2022-04-03 01:25:26 +00:00
|
|
|
{% end %}
|
2022-08-20 12:49:38 +00:00
|
|
|
|
|
|
|
{% if not data['superuser'] %}
|
2022-08-20 12:32:39 +00:00
|
|
|
{% for role in data['managed_roles'] %}
|
|
|
|
{% if role.role_id not in data['assigned_roles'] %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ role.role_name }}</td>
|
|
|
|
<td id="role_list_{{role.role_id}}">
|
|
|
|
<ul id="{{role.role_id}}">
|
|
|
|
{% for item in data['role-servers'][role.role_id] %}
|
|
|
|
<li>{{item}}</li>
|
|
|
|
{% end %}
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<ul>
|
|
|
|
{% for user in data['users'] %}
|
|
|
|
{% for ruser in data['user-roles'][user.user_id] %}
|
|
|
|
{% if ruser == role.role_name %}
|
|
|
|
<li>{{ user.username }}</li>
|
|
|
|
{% end %}
|
|
|
|
{% end %}
|
|
|
|
{% end %}
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
<td><a href="/panel/edit_role?id={{role.role_id}}"><i class="fas fa-pencil-alt"></i></a></td>
|
|
|
|
</tr>
|
2022-08-20 12:49:38 +00:00
|
|
|
{% end %}
|
|
|
|
{% end %}
|
2022-08-20 12:32:39 +00:00
|
|
|
{% end %}
|
2020-12-27 16:00:26 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-02-12 17:29:05 +00:00
|
|
|
{% if data['superuser'] and not data["docker"] %}
|
2022-03-02 17:55:49 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
2022-04-03 01:25:26 +00:00
|
|
|
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('panelConfig', 'adminControls',
|
|
|
|
data['lang']) }}</h4>
|
2022-03-02 17:55:49 +00:00
|
|
|
</div>
|
2023-01-30 20:23:10 +00:00
|
|
|
<br>
|
|
|
|
<form id="server-path">
|
2023-01-30 22:23:25 +00:00
|
|
|
<div class="form-group">
|
2023-01-31 04:32:45 +00:00
|
|
|
<label for="global_server_path">{{ translate('panelConfig', 'globalServer',
|
|
|
|
data['lang']) }}<small class="text-muted ml-1"> - {{ translate('panelConfig', 'globalExplain',
|
|
|
|
data['lang']) }}</small></label>
|
2023-01-30 22:23:25 +00:00
|
|
|
<div class="input-group">
|
|
|
|
<input type="text" id="global_server_path" class="form-control" name="global_server_path"
|
|
|
|
placeholder="/var/opt/servers" value="{{data['servers_dir']}}" directory>
|
|
|
|
<div class="input-group-append">
|
|
|
|
<span type="button" class="btn btn-outline-default custom-picker">/servers/</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-01-30 20:39:09 +00:00
|
|
|
<button class="btn btn-success" type="submit">Submit</button> <span id="submit-status"></span>
|
2023-01-30 23:31:46 +00:00
|
|
|
<br>
|
|
|
|
<span id="submit-list"></span>
|
2023-01-30 20:23:10 +00:00
|
|
|
</form>
|
2022-11-09 19:13:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-03-02 17:55:49 +00:00
|
|
|
{% end %}
|
2020-12-06 20:42:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
2021-09-28 21:02:15 +00:00
|
|
|
|
|
|
|
<style>
|
2023-10-09 02:13:55 +00:00
|
|
|
.clickable {
|
|
|
|
color: #007bff;
|
|
|
|
}
|
|
|
|
.clickable:hover {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2023-01-30 20:30:11 +00:00
|
|
|
.custom-picker {
|
|
|
|
border: 1px solid var(--outline);
|
|
|
|
}
|
|
|
|
|
2022-04-03 01:25:26 +00:00
|
|
|
.popover-body {
|
|
|
|
color: white !important;
|
|
|
|
;
|
|
|
|
}
|
2023-01-30 23:31:46 +00:00
|
|
|
|
|
|
|
.loading:after {
|
|
|
|
overflow: hidden;
|
|
|
|
display: inline-block;
|
|
|
|
vertical-align: bottom;
|
|
|
|
-webkit-animation: ellipsis steps(4, end) 900ms infinite;
|
|
|
|
animation: ellipsis steps(4, end) 900ms infinite;
|
|
|
|
content: "\2026";
|
|
|
|
/* ascii code for the ellipsis character */
|
|
|
|
width: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes ellipsis {
|
|
|
|
to {
|
|
|
|
width: 1.25em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@-webkit-keyframes ellipsis {
|
|
|
|
to {
|
|
|
|
width: 1.25em;
|
|
|
|
}
|
|
|
|
}
|
2021-09-28 21:02:15 +00:00
|
|
|
</style>
|
2020-12-06 20:42:49 +00:00
|
|
|
<!-- content-wrapper ends -->
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script>
|
2023-10-08 02:10:15 +00:00
|
|
|
function validateForm() {
|
|
|
|
let password0 = document.getElementById("password0").value;
|
|
|
|
let password1 = document.getElementById("password1").value;
|
|
|
|
if (password0 != password1) {
|
|
|
|
$('.passwords-match').popover('show');
|
|
|
|
$('.popover-body').click(function () {
|
|
|
|
$('.passwords-match').popover("hide");
|
|
|
|
});
|
|
|
|
document.body.scrollTop = 0;
|
|
|
|
document.documentElement.scrollTop = 0;
|
|
|
|
$("#password0").css("outline", "1px solid red");
|
|
|
|
$("#password1").css("outline", "1px solid red");
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return password1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$(".edit_password").on("click", async function(){
|
|
|
|
const token = getCookie("_xsrf");
|
|
|
|
let user_id = $(this).data('id');
|
2023-10-07 18:42:52 +00:00
|
|
|
bootbox.confirm(`<form class="form" id='infos' action=''>\
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="new_password">New Password</label>
|
2023-10-08 02:10:15 +00:00
|
|
|
<input class="form-control" type='password' id="password0" name='new_password' /></br>\
|
2023-10-07 18:42:52 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="confirm_password">Confirm Password</label>
|
2023-10-08 02:10:15 +00:00
|
|
|
<input class="form-control" type='password' id="password1" name='confirm_password' />\
|
2023-10-07 18:42:52 +00:00
|
|
|
</div>
|
2023-10-08 02:10:15 +00:00
|
|
|
</form>`, async function(result) {
|
|
|
|
if(result){
|
|
|
|
password = validateForm();
|
|
|
|
if (!password){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let res = await fetch(`/api/v2/users/${user_id}`, {
|
|
|
|
method: 'PATCH',
|
|
|
|
headers: {
|
|
|
|
'X-XSRFToken': token
|
|
|
|
},
|
|
|
|
body: JSON.stringify({"password": password}),
|
|
|
|
});
|
|
|
|
let responseData = await res.json();
|
|
|
|
if (responseData.status === "ok") {
|
|
|
|
console.log(responseData.data)
|
|
|
|
} else {
|
|
|
|
|
|
|
|
bootbox.alert({
|
|
|
|
title: responseData.status,
|
|
|
|
message: responseData.error
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2023-10-07 18:42:52 +00:00
|
|
|
});
|
|
|
|
});
|
2023-10-09 02:13:55 +00:00
|
|
|
$(document).on("submit", ".bootbox form", function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$(".bootbox .btn-primary").click();
|
|
|
|
});
|
|
|
|
|
2023-10-07 18:42:52 +00:00
|
|
|
$(".edit_user").on("click", function(){
|
2023-10-08 02:10:15 +00:00
|
|
|
const token = getCookie("_xsrf");
|
2023-10-07 18:42:52 +00:00
|
|
|
let username = $(this).data('name');
|
2023-10-08 02:10:15 +00:00
|
|
|
let user_id = $(this).data('id');
|
2023-10-07 18:42:52 +00:00
|
|
|
bootbox.confirm(`<form class="form" id='infos' action=''>\
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="username">Username</label>
|
2023-10-09 02:13:55 +00:00
|
|
|
<input class="form-control" type='text' name='username' id="username_field" value=${username} /><br/>\
|
2023-10-07 18:42:52 +00:00
|
|
|
</div>
|
2023-10-09 02:13:55 +00:00
|
|
|
</form>`, async function(result) {
|
|
|
|
if(result){
|
|
|
|
let new_username = $("#username_field").val();
|
|
|
|
let res = await fetch(`/api/v2/users/${user_id}`, {
|
|
|
|
method: 'PATCH',
|
|
|
|
headers: {
|
|
|
|
'X-XSRFToken': token
|
|
|
|
},
|
|
|
|
body: JSON.stringify({"username": new_username}),
|
|
|
|
});
|
|
|
|
let responseData = await res.json();
|
|
|
|
if (responseData.status === "ok") {
|
|
|
|
$(`#user_${user_id}`).html(` ${new_username}`)
|
|
|
|
$(`#username_${user_id}`).data('name', new_username);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
bootbox.alert({
|
|
|
|
title: responseData.status,
|
|
|
|
message: responseData.error
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2023-10-07 18:42:52 +00:00
|
|
|
});
|
|
|
|
});
|
2023-01-30 23:31:46 +00:00
|
|
|
if (webSocket) {
|
|
|
|
webSocket.on('move_status', function (message) {
|
|
|
|
if (message === "done") {
|
|
|
|
$("#submit-list").removeClass("loading");
|
|
|
|
$("#submit-list").html("");
|
|
|
|
$("#submit-status").html('<i class="fa fa-check"></i>');
|
|
|
|
} else {
|
|
|
|
$("#submit-status").html('<i class="fa fa-spinner fa-spin"></i>');
|
|
|
|
$("#submit-list").html(message);
|
|
|
|
$("#submit-list").addClass("loading");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-01-30 20:23:10 +00:00
|
|
|
|
2023-09-04 16:34:39 +00:00
|
|
|
$("#server-path").submit(async function (e) {
|
2023-09-04 23:22:11 +00:00
|
|
|
const token = getCookie("_xsrf")
|
2023-01-30 20:23:10 +00:00
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
$("#submit-status").html('<i class="fa fa-spinner fa-spin"></i>');
|
|
|
|
|
|
|
|
let path = $("#global_server_path").val();
|
2023-09-04 16:34:39 +00:00
|
|
|
let res = await fetch(`/api/v2/crafty/config/servers_dir`, {
|
2023-09-04 23:22:11 +00:00
|
|
|
method: 'PATCH',
|
|
|
|
headers: {
|
|
|
|
'X-XSRFToken': token
|
|
|
|
},
|
|
|
|
body: JSON.stringify({ "new_dir": path }),
|
|
|
|
});
|
|
|
|
let responseData = await res.json();
|
|
|
|
if (responseData.status === "ok") {
|
|
|
|
return
|
|
|
|
} else {
|
2023-09-04 16:34:39 +00:00
|
|
|
|
2023-09-04 23:22:11 +00:00
|
|
|
bootbox.alert({
|
|
|
|
title: responseData.status,
|
|
|
|
message: responseData.error
|
|
|
|
});
|
|
|
|
}
|
2023-01-30 20:23:10 +00:00
|
|
|
});
|
|
|
|
|
2022-04-03 01:25:26 +00:00
|
|
|
$(document).ready(function () {
|
|
|
|
$('[data-toggle="popover"]').popover();
|
|
|
|
if ($(window).width() < 1000) {
|
|
|
|
$('.too_small').popover("show");
|
|
|
|
$('.too_small2').popover("show");
|
|
|
|
}
|
2021-10-04 15:06:57 +00:00
|
|
|
|
2022-04-03 01:25:26 +00:00
|
|
|
});
|
|
|
|
$(window).ready(function () {
|
|
|
|
$('body').click(function () {
|
|
|
|
$('.too_small').popover("hide");
|
|
|
|
$('.too_small2').popover("hide");
|
2021-09-28 21:02:15 +00:00
|
|
|
});
|
2022-04-03 01:25:26 +00:00
|
|
|
});
|
|
|
|
$(window).resize(function () {
|
|
|
|
// This will execute whenever the window is resized
|
|
|
|
if ($(window).width() < 1000) {
|
|
|
|
$('.too_small').popover("show");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('.too_small').popover("hide");
|
|
|
|
} // New width
|
|
|
|
if ($(window).width() < 1000) {
|
|
|
|
$('.too_small2').popover("show");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('.too_small2').popover("hide");
|
|
|
|
} // New width
|
|
|
|
});
|
2022-11-30 23:14:37 +00:00
|
|
|
$('#file').change(function () {
|
|
|
|
console.log("File changed");
|
|
|
|
if ($('#file').val()) {
|
|
|
|
$('#upload-button').prop("disabled", false);
|
|
|
|
console.log("File changed good");
|
|
|
|
}
|
|
|
|
});
|
2021-09-28 21:02:15 +00:00
|
|
|
</script>
|
2020-12-06 20:42:49 +00:00
|
|
|
|
|
|
|
{% end %}
|