Progress.
This commit is contained in:
parent
2a47c0ba5e
commit
32e0c959e8
src/snek
@ -42,6 +42,7 @@ from snek.view.terminal import TerminalSocketView, TerminalView
|
|||||||
from snek.view.upload import UploadView
|
from snek.view.upload import UploadView
|
||||||
from snek.view.web import WebView
|
from snek.view.web import WebView
|
||||||
from snek.webdav import WebdavApplication
|
from snek.webdav import WebdavApplication
|
||||||
|
from snek.view.settings import SettingsView
|
||||||
|
|
||||||
SESSION_KEY = b"c79a0c5fda4b424189c427d28c9f7c34"
|
SESSION_KEY = b"c79a0c5fda4b424189c427d28c9f7c34"
|
||||||
|
|
||||||
@ -137,6 +138,7 @@ class Application(BaseApplication):
|
|||||||
self.router.add_view("/docs.html", DocsHTMLView)
|
self.router.add_view("/docs.html", DocsHTMLView)
|
||||||
self.router.add_view("/docs.md", DocsMDView)
|
self.router.add_view("/docs.md", DocsMDView)
|
||||||
self.router.add_view("/status.json", StatusView)
|
self.router.add_view("/status.json", StatusView)
|
||||||
|
self.router.add_view("/settings.html", SettingsView)
|
||||||
self.router.add_view("/web.html", WebView)
|
self.router.add_view("/web.html", WebView)
|
||||||
self.router.add_view("/login.html", LoginView)
|
self.router.add_view("/login.html", LoginView)
|
||||||
self.router.add_view("/login.json", LoginView)
|
self.router.add_view("/login.json", LoginView)
|
||||||
|
36
src/snek/templates/settings.html
Normal file
36
src/snek/templates/settings.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{% extends "app.html" %}
|
||||||
|
|
||||||
|
{% block sidebar %}
|
||||||
|
|
||||||
|
{% include "sidebar_settings.html" %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<link href="https://cdn.bootcdn.net/ajax/libs/monaco-editor/0.20.0/min/vs/editor/editor.main.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<script src="https://cdn.bootcdn.net/ajax/libs/monaco-editor/0.20.0/min/vs/loader.min.js"></script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block main %}
|
||||||
|
|
||||||
|
<h1>Setting page</h1>
|
||||||
|
|
||||||
|
<div id="profile_description"></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
|
||||||
|
require.config({ paths: { 'vs': 'https://cdn.bootcdn.net/ajax/libs/monaco-editor/0.20.0/min/vs' } });
|
||||||
|
|
||||||
|
require(['vs/editor/editor.main'], function () {
|
||||||
|
var editor = monaco.editor.create(document.getElementById('profile_description'), {
|
||||||
|
value: phpCode,
|
||||||
|
language: 'php'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% endblock main %}
|
14
src/snek/templates/sidebar_settings.html
Normal file
14
src/snek/templates/sidebar_settings.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<style>
|
||||||
|
.channel-list-item-highlight {
|
||||||
|
/* xxx */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<aside class="sidebar" id="channelSidebar">
|
||||||
|
<h2>Settings</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a class="no-select" href="/settings.html">Profile</a></li>
|
||||||
|
<li><a class="no-select" href="/settings-notifications.html">Notifications</a></li>
|
||||||
|
<li><a class="no-select" href="/settings-privacy.html">Privacy</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</aside>
|
8
src/snek/view/settings.py
Normal file
8
src/snek/view/settings.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from snek.system.view import BaseView
|
||||||
|
|
||||||
|
class SettingsView(BaseView):
|
||||||
|
|
||||||
|
login_required = True
|
||||||
|
|
||||||
|
async def get(self):
|
||||||
|
return await self.render_template('settings.html')
|
@ -219,8 +219,9 @@ class WebdavApplication(aiohttp.web.Application):
|
|||||||
etree.SubElement(prop, "{DAV:}displayname").text = full_path.name
|
etree.SubElement(prop, "{DAV:}displayname").text = full_path.name
|
||||||
etree.SubElement(prop, "{DAV:}lockdiscovery")
|
etree.SubElement(prop, "{DAV:}lockdiscovery")
|
||||||
mimetype, _ = mimetypes.guess_type(full_path.name)
|
mimetype, _ = mimetypes.guess_type(full_path.name)
|
||||||
etree.SubElement(prop, "{DAV:}contenttype").text = mimetype
|
if full_path.is_file():
|
||||||
etree.SubElement(prop, "{DAV:}getcontentlength").text = str(
|
etree.SubElement(prop, "{DAV:}contenttype").text = mimetype
|
||||||
|
etree.SubElement(prop, "{DAV:}getcontentlength").text = str(
|
||||||
full_path.stat().st_size
|
full_path.stat().st_size
|
||||||
if full_path.is_file()
|
if full_path.is_file()
|
||||||
else self.get_directory_size(full_path)
|
else self.get_directory_size(full_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user