diff --git a/dislocker_auth.py b/dislocker_auth.py
index a473650..1930f35 100644
--- a/dislocker_auth.py
+++ b/dislocker_auth.py
@@ -1,7 +1,7 @@
import psycopg2
import os
import json
-from flask import Flask, request, jsonify, render_template
+from flask import Flask, request, jsonify, render_template, redirect
import uuid
import string
import random
@@ -337,7 +337,12 @@ class Auth():
finally:
cursor.close()
-
+
+ def get_pc_list(self, **kwargs):
+ cursor = self.db.cursor()
+ cursor.execute('SELECT pc_number, alt_name, master_password FROM pc_list ORDER BY pc_number')
+ pc_list = cursor.fetchall()
+ return pc_list
app = Flask(__name__, static_folder="./resource/")
auth = Auth(server_config["db"]["host"], server_config["db"]["db_name"], server_config["db"]["port"], server_config["db"]["username"], server_config["db"]["password"])
@@ -479,6 +484,33 @@ def device_register():
else:
return jsonify({'message': 'damedesu'}), 401
+@app.route('/')
+def index():
+ return redirect('/admin')
+
+@app.route('/admin')
+def admin():
+ return render_template('admin.html')
+
+@app.route('/admin/pc_list')
+def admin_pclist():
+ table = '
PC番号 | ニックネーム | マスターパスワード |
'
+ pc_list = auth.get_pc_list()
+ for i in pc_list:
+ pc_number = i[0]
+ alt_name = i[1]
+ if alt_name == None:
+ alt_name = '--未登録--'
+
+ master_password = i[2]
+ if master_password == None:
+ master_password = '--未登録--'
+
+ table += f'{pc_number} | {alt_name} | {master_password} |
'
+
+ table += '
'
+
+ return render_template('pc_list.html', pc_list_table=table)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000, debug=False)
\ No newline at end of file
diff --git a/resource/css/admin.css b/resource/css/admin.css
new file mode 100644
index 0000000..25865dd
--- /dev/null
+++ b/resource/css/admin.css
@@ -0,0 +1,13 @@
+#sidebar {
+
+ height: 100%;
+ width: 30%;
+ background-color: aliceblue;
+ display: flex;
+ justify-content: center;
+}
+
+#general {
+ display: flex;
+ float: left;
+}
\ No newline at end of file
diff --git a/templates/admin.html b/templates/admin.html
new file mode 100644
index 0000000..a11fde9
--- /dev/null
+++ b/templates/admin.html
@@ -0,0 +1,24 @@
+
+
+
+ Dislocker Admin
+
+
+
+
+
+
+
+
+
+
Dislocker ADMIN
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/pc_list.html b/templates/pc_list.html
new file mode 100644
index 0000000..d319eba
--- /dev/null
+++ b/templates/pc_list.html
@@ -0,0 +1,24 @@
+
+
+
+ Dislocker Admin | PC List
+
+
+
+
+
+
+
+
+
+
PCリストあるよ(笑)
+ {{pc_list_table | safe}}
+
+
+
+
+
\ No newline at end of file