mirror of
https://github.com/star-inc/yuuki.git
synced 2024-11-10 17:13:10 +08:00
Update
This commit is contained in:
parent
8ec9e1592a
commit
650c8d4a3d
10 changed files with 163 additions and 4 deletions
|
@ -26,6 +26,11 @@ class Yuuki_WebAdminAPI:
|
|||
pass
|
||||
return self.YukkiData.getData(["Global", "GroupJoined"])
|
||||
|
||||
def get_helpers(self, data):
|
||||
if data:
|
||||
pass
|
||||
return self.YukkiData.getData(["Global", "GroupJoined"])
|
||||
|
||||
def get_logs(self, data):
|
||||
return self.Yuuki_DataHandle.get_logs(data)
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ class Yuuki_WebAdmin:
|
|||
if "yuuki_admin" in request.cookies:
|
||||
if request.cookies["yuuki_admin"] in passports:
|
||||
return render_template(
|
||||
'manage/groups.html'
|
||||
'manage/groups.html',
|
||||
LINE_Media_server=Yuuki_Handle.LINE_Media_server
|
||||
)
|
||||
response = redirect("/")
|
||||
response.set_cookie(
|
||||
|
@ -99,7 +100,9 @@ class Yuuki_WebAdmin:
|
|||
if "yuuki_admin" in request.cookies:
|
||||
if request.cookies["yuuki_admin"] in passports:
|
||||
return render_template(
|
||||
'manage/settings.html'
|
||||
'manage/settings.html',
|
||||
version=Yuuki_Handle.YuukiConfigs["version"],
|
||||
project_url=Yuuki_Handle.YuukiConfigs["project_url"]
|
||||
)
|
||||
response = redirect("/")
|
||||
response.set_cookie(
|
||||
|
|
|
@ -11,6 +11,11 @@ body {
|
|||
color: #ff0000;
|
||||
}
|
||||
|
||||
.mini-logo {
|
||||
max-width:32px;
|
||||
height:32px;
|
||||
}
|
||||
|
||||
.password_box {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
|
|
|
@ -11,7 +11,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
var events = [
|
||||
"JoinGroup",
|
||||
"KickEvent",
|
||||
"CancelEvent"
|
||||
"CancelEvent",
|
||||
"BlackList"
|
||||
];
|
||||
|
||||
function format2html(title, context) {
|
||||
|
@ -31,7 +32,7 @@ function log_query(data) {
|
|||
task: "get_logs",
|
||||
data: data
|
||||
},
|
||||
error: function (xhr) {
|
||||
error: function () {
|
||||
alert("Something was wrong.");
|
||||
},
|
||||
success: function (response) {
|
||||
|
|
54
libs/webadmin/static/js/groups.js
Normal file
54
libs/webadmin/static/js/groups.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*jshint esversion: 6 */
|
||||
|
||||
/*
|
||||
Yuuki_Libs
|
||||
(c) 2020 Star Inc.
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
var events = [
|
||||
"JoinGroup",
|
||||
"KickEvent",
|
||||
"CancelEvent"
|
||||
];
|
||||
|
||||
function format2html(title, context) {
|
||||
return "<div class=\"media pt-3\">" +
|
||||
"<img class=\"mini-logo mr-2 rounded\" src=\"" + object_server + "/os/g/" + title + "\">" +
|
||||
"<p class=\"media-body pb-3 mb-0 small lh-125 border-bottom border-gray\">" +
|
||||
"<strong class=\"d-block text-gray-dark\">" + title + "</strong>" +
|
||||
context +
|
||||
"</p>" +
|
||||
"</div>";
|
||||
}
|
||||
|
||||
$(function () {
|
||||
url = window.location.href;
|
||||
$.ajax({
|
||||
url: "/api",
|
||||
type: "POST",
|
||||
data: {
|
||||
task: "get_groups_joined"
|
||||
},
|
||||
error: function () {
|
||||
alert("Something was wrong.");
|
||||
},
|
||||
success: function (response) {
|
||||
let show = "";
|
||||
if (response.result.length) {
|
||||
response.result.forEach(element => {
|
||||
show += format2html(
|
||||
element,
|
||||
element
|
||||
);
|
||||
});
|
||||
} else {
|
||||
show += "<p class=\"pt-3\">Nothing</p>";
|
||||
}
|
||||
$("#groups").html(show);
|
||||
$("#groups").fadeIn();
|
||||
}
|
||||
});
|
||||
});
|
37
libs/webadmin/static/js/index.js
Normal file
37
libs/webadmin/static/js/index.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*jshint esversion: 6 */
|
||||
|
||||
/*
|
||||
Yuuki_Libs
|
||||
(c) 2020 Star Inc.
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
function init(id, data) {
|
||||
$.ajax({
|
||||
url: "/api",
|
||||
type: "POST",
|
||||
data: {
|
||||
task: "get_logs",
|
||||
data: data
|
||||
},
|
||||
error: function () {
|
||||
alert("Something was wrong.");
|
||||
},
|
||||
success: function (response) {
|
||||
let ajax_result = response.result;
|
||||
if (ajax_result.length)
|
||||
$(id).text(ajax_result[ajax_result.length - 1]);
|
||||
else
|
||||
$(id).text("Nothing");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
init("#Join_Event", "JoinGroup");
|
||||
init("#Kick_Event", "KickEvent");
|
||||
init("#Cancel_Event", "CancelEvent");
|
||||
init("#Block_Event", "BlackList");
|
||||
});
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
<!-- Optional JavaScript -->
|
||||
{{ bootstrap.load_js() }}
|
||||
<script>var object_server="{{ LINE_Media_server }}";</script>
|
||||
<script src="{{ url_for('static', filename='js/header.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/groups.js') }}"></script>
|
||||
</body>
|
||||
|
|
38
libs/webadmin/templates/manage/helpers.html
Normal file
38
libs/webadmin/templates/manage/helpers.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
{{ bootstrap.load_css() }}
|
||||
<link rel="stylesheet" href="https://unpkg.com/lookforward@0.1.1/css/lookforward.min.css">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}" />
|
||||
|
||||
<title>Star Yuuki BOT - WebAdmin</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{% from 'bootstrap/nav.html' import render_nav_item %}
|
||||
|
||||
<div id="header"></div>
|
||||
|
||||
<main role="main" class="container">
|
||||
<div class="my-3 p-3 bg-white rounded shadow-sm">
|
||||
<h6 class="border-bottom border-gray pb-2 mb-0">Helpers</h6>
|
||||
<div id="groups">
|
||||
<p class="pt-3">Loading...</p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
{{ bootstrap.load_js() }}
|
||||
<script src="{{ url_for('static', filename='js/header.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/helpers.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -67,6 +67,18 @@
|
|||
<span id="Cancel_Event">Please wait.</span>
|
||||
</p>
|
||||
</a>
|
||||
<a class="media text-muted pt-3" href="/events#BlackList">
|
||||
<svg class="bd-placeholder-img mr-2 rounded" width="32" height="32" xmlns="http://www.w3.org/2000/svg"
|
||||
preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: 32x32">
|
||||
<title>Block Event</title>
|
||||
<rect width="100%" height="100%" fill="#00ff00" />
|
||||
<text x="50%" y="50%" fill="#00ff00" dy=".3em">32x32</text>
|
||||
</svg>
|
||||
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
|
||||
<strong class="d-block text-gray-dark">[Block Event]</strong>
|
||||
<span id="Block_Event">Please wait.</span>
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
Turn off the BOT.
|
||||
</p>
|
||||
</a>
|
||||
<small class="d-block text-right mt-3">
|
||||
<a href="{{ project_url }}" target="_blank">Version: {{ version }}</a>
|
||||
</small>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
|
Loading…
Reference in a new issue