TailwindCSS setup and project files structure redone
parent
f6e6e379fb
commit
1010621929
|
@ -139,5 +139,13 @@ cython_debug/
|
|||
|
||||
# other
|
||||
.vscode/
|
||||
*.code-workspace
|
||||
.idea/
|
||||
log.txt
|
||||
log.txt
|
||||
|
||||
.yarn/*
|
||||
.yarn/releases
|
||||
.yarn/plugins
|
||||
.yarn/sdks
|
||||
.yarn/versions
|
||||
.pnp.*
|
|
@ -0,0 +1 @@
|
|||
yarnPath: .yarn/releases/yarn-2.3.3.cjs
|
|
@ -0,0 +1,5 @@
|
|||
@import "tailwindcss/base";
|
||||
|
||||
@import "tailwindcss/components";
|
||||
|
||||
@import "tailwindcss/utilities";
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "minetest-web-gui",
|
||||
"version": "1.0.0",
|
||||
"description": "Minetest Server's Management web gui",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "postcss css_src/style.css -o src/static/style.css"
|
||||
},
|
||||
"repository": "git@gitlab.com:SonoMichele/minetest-web-gui.git",
|
||||
"author": "SonoMichele <micheleviotto@protonmail.com>",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"autoprefixer": "^10.0.2",
|
||||
"cssnano": "^4.1.10",
|
||||
"postcss": "^8.1.7",
|
||||
"postcss-cli": "^8.2.0",
|
||||
"postcss-import": "^13.0.0",
|
||||
"tailwindcss": "^1.9.6"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
module.exports = {
|
||||
plugins: [
|
||||
require("postcss-import"),
|
||||
require("tailwindcss"),
|
||||
require("autoprefixer"),
|
||||
require("cssnano")({
|
||||
preset: "default",
|
||||
}),
|
||||
],
|
||||
};
|
|
@ -35,52 +35,55 @@ def create_app(config_class=Config):
|
|||
app = Flask(__name__)
|
||||
app.config.from_object(config_class)
|
||||
|
||||
from src.views import main
|
||||
app.register_blueprint(main.main)
|
||||
|
||||
# this thing streams the console output and is used by the index route
|
||||
@app.route('/stream')
|
||||
def stream():
|
||||
def read_process():
|
||||
global SERVER_GROUP
|
||||
global SERVER_PROCESS
|
||||
while SERVER_GROUP.is_pending():
|
||||
lines = SERVER_GROUP.readlines()
|
||||
for proc, line in lines:
|
||||
# yield 'data:' + line.decode('utf-8') + '\n\n'
|
||||
if '[24d]' not in line: # the stream spams lines starting with this pattern, so I exclude it and the user doesn't see it
|
||||
yield 'data:' + line + '\n\n'
|
||||
# @app.route('/stream')
|
||||
# def stream():
|
||||
# def read_process():
|
||||
# global SERVER_GROUP
|
||||
# global SERVER_PROCESS
|
||||
# while SERVER_GROUP.is_pending():
|
||||
# lines = SERVER_GROUP.readlines()
|
||||
# for proc, line in lines:
|
||||
# # yield 'data:' + line.decode('utf-8') + '\n\n'
|
||||
# if '[24d]' not in line: # the stream spams lines starting with this pattern, so I exclude it and the user doesn't see it
|
||||
# yield 'data:' + line + '\n\n'
|
||||
|
||||
return Response(read_process(), mimetype='text/event-stream')
|
||||
# return Response(read_process(), mimetype='text/event-stream')
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
# @app.route('/')
|
||||
# def index():
|
||||
# return render_template('index.html')
|
||||
|
||||
@app.route('/start')
|
||||
def start():
|
||||
global SERVER_PROCESS
|
||||
if SERVER_PROCESS is None:
|
||||
# i need encoding=utf-8 or the input doesn't work and if I use shell=True the command ignores parameters idk why
|
||||
SERVER_PROCESS = SERVER_GROUP.run('minetestserver --terminal --logfile log.txt', encoding='utf-8')
|
||||
# SERVER_PROCESS = subprocess.Popen('minetestserver --terminal', text=True, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
r.set('running', '1')
|
||||
return str(SERVER_PROCESS.pid)
|
||||
return f'Already running, {SERVER_PROCESS.pid}.'
|
||||
# @app.route('/start')
|
||||
# def start():
|
||||
# global SERVER_PROCESS
|
||||
# if SERVER_PROCESS is None:
|
||||
# # i need encoding=utf-8 or the input doesn't work and if I use shell=True the command ignores parameters idk why
|
||||
# SERVER_PROCESS = SERVER_GROUP.run('minetestserver --terminal --logfile log.txt', encoding='utf-8')
|
||||
# # SERVER_PROCESS = subprocess.Popen('minetestserver --terminal', text=True, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
# r.set('running', '1')
|
||||
# return str(SERVER_PROCESS.pid)
|
||||
# return f'Already running, {SERVER_PROCESS.pid}.'
|
||||
|
||||
@app.route('/stop')
|
||||
def stop():
|
||||
global SERVER_PROCESS
|
||||
if r.get('running') and r.get('running').decode('utf-8') == '1':
|
||||
SERVER_PROCESS.send_signal(signal.SIGTERM)
|
||||
SERVER_PROCESS = None
|
||||
r.set('running', '0')
|
||||
return 'Stopped'
|
||||
return 'Already stopped.'
|
||||
# @app.route('/stop')
|
||||
# def stop():
|
||||
# global SERVER_PROCESS
|
||||
# if r.get('running') and r.get('running').decode('utf-8') == '1':
|
||||
# SERVER_PROCESS.send_signal(signal.SIGTERM)
|
||||
# SERVER_PROCESS = None
|
||||
# r.set('running', '0')
|
||||
# return 'Stopped'
|
||||
# return 'Already stopped.'
|
||||
|
||||
@app.route('/test')
|
||||
def test():
|
||||
# this piece of code runs commands on the server console
|
||||
global SERVER_PROCESS
|
||||
SERVER_PROCESS.stdin.writelines("/kick SonoMichele\n")
|
||||
SERVER_PROCESS.stdin.flush()
|
||||
return redirect(url_for('index'))
|
||||
# @app.route('/test')
|
||||
# def test():
|
||||
# # this piece of code runs commands on the server console
|
||||
# global SERVER_PROCESS
|
||||
# SERVER_PROCESS.stdin.writelines("/kick SonoMichele\n")
|
||||
# SERVER_PROCESS.stdin.flush()
|
||||
# return redirect(url_for('index'))
|
||||
|
||||
return app
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,37 @@
|
|||
<!--
|
||||
# Minetest Web Gui is a webapp for managing a minetest server via a gui
|
||||
# Copyright (C) 2020 SonoMichele (Michele Viotto)
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Minetest Web Gui</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ url_for('static', filename='style.css') }}"
|
||||
/>
|
||||
</head>
|
||||
<body class="bg-nord0 min-h-screen">
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
{% block footer %}
|
||||
{% endblock footer %}
|
||||
{% block scripts %}
|
||||
{% endblock scripts %}
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% endblock content %}
|
|
@ -0,0 +1,18 @@
|
|||
# Minetest Web Gui is a webapp for managing a minetest server via a gui
|
||||
# Copyright (C) 2020 SonoMichele (Michele Viotto)
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# views package
|
|
@ -0,0 +1,21 @@
|
|||
# Minetest Web Gui is a webapp for managing a minetest server via a gui
|
||||
# Copyright (C) 2020 SonoMichele (Michele Viotto)
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# main view package
|
||||
|
||||
|
||||
from src.views.main.routes import main
|
|
@ -0,0 +1,9 @@
|
|||
from flask import Blueprint, render_template
|
||||
|
||||
|
||||
main = Blueprint('main', __name__)
|
||||
|
||||
|
||||
@main.route('/')
|
||||
def home():
|
||||
return render_template('main/home.html')
|
2
start.py
2
start.py
|
@ -20,4 +20,4 @@ from src import create_app
|
|||
|
||||
if __name__ == '__main__':
|
||||
app = create_app()
|
||||
app.run(debug=True, port=5001)
|
||||
app.run(debug=True)
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
module.exports = {
|
||||
future: {
|
||||
// removeDeprecatedGapUtilities: true,
|
||||
// purgeLayersByDefault: true,
|
||||
},
|
||||
purge: [],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
nord0: "#2e3440",
|
||||
nord1: "#3b4252",
|
||||
nord2: "#434c5e",
|
||||
nord3: "#4c566a",
|
||||
nord4: "#d8dee9",
|
||||
nord5: "#e5e9f0",
|
||||
nord6: "#eceff4",
|
||||
nord7: "#8fbcbb",
|
||||
nord8: "#88c0d0",
|
||||
nord9: "#81a1c1",
|
||||
nord10: "#5e81ac",
|
||||
nord11: "#bf616a",
|
||||
nord12: "#d08770",
|
||||
nord13: "#ebcb8b",
|
||||
nord14: "#a3be8c",
|
||||
nord15: "#b48ead",
|
||||
},
|
||||
},
|
||||
},
|
||||
variants: {},
|
||||
plugins: [],
|
||||
};
|
Loading…
Reference in New Issue