Progress.

This commit is contained in:
retoor 2025-04-01 16:21:29 +02:00
parent 2a47c0ba5e
commit 32e0c959e8
5 changed files with 63 additions and 2 deletions

View File

@ -42,6 +42,7 @@ from snek.view.terminal import TerminalSocketView, TerminalView
from snek.view.upload import UploadView
from snek.view.web import WebView
from snek.webdav import WebdavApplication
from snek.view.settings import SettingsView
SESSION_KEY = b"c79a0c5fda4b424189c427d28c9f7c34"
@ -137,6 +138,7 @@ class Application(BaseApplication):
self.router.add_view("/docs.html", DocsHTMLView)
self.router.add_view("/docs.md", DocsMDView)
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("/login.html", LoginView)
self.router.add_view("/login.json", LoginView)

View 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 %}

View 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>

View 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')

View File

@ -219,8 +219,9 @@ class WebdavApplication(aiohttp.web.Application):
etree.SubElement(prop, "{DAV:}displayname").text = full_path.name
etree.SubElement(prop, "{DAV:}lockdiscovery")
mimetype, _ = mimetypes.guess_type(full_path.name)
etree.SubElement(prop, "{DAV:}contenttype").text = mimetype
etree.SubElement(prop, "{DAV:}getcontentlength").text = str(
if full_path.is_file():
etree.SubElement(prop, "{DAV:}contenttype").text = mimetype
etree.SubElement(prop, "{DAV:}getcontentlength").text = str(
full_path.stat().st_size
if full_path.is_file()
else self.get_directory_size(full_path)