Commit ed7ef7e2 authored by jan.koester's avatar jan.koester
Browse files

testt

parent f34b2ac3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -14,3 +14,8 @@ WEBEDIT:
    - "/usr/lib/blogi/plugins/webedit"
  HTMLDIR: "/usr/share/blogi-editor/html"
  PREFIX: ""
  AUTHDB:
    - URL: "https://localhost:8443"
      CLIENTNAME: "blogi-editor"
      CLIENTSECRET: "changeme"
      DOMAIN: "localhost"
+5 −0
Original line number Diff line number Diff line
@@ -15,3 +15,8 @@ WEBEDIT:
    - "../build/editor/widgets"
  HTMLDIR: "/usr/local/share/blogi-webedit/html"
  PREFIX: ""
  AUTHDB:
    - URL: "https://localhost:8443"
      CLIENTNAME: "blogi-editor"
      CLIENTSECRET: "changeme"
      DOMAIN: "localhost"
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@
        <div class="toolbar-group">
            <span id="doc-name" class="doc-name">Untitled</span>
        </div>
        <div class="toolbar-group" style="margin-left:auto">
            <button id="btn-logout" title="Abmelden">&#x1F6AA; Abmelden</button>
        </div>
    </header>

    <div id="app">
+20 −0
Original line number Diff line number Diff line
@@ -12,6 +12,11 @@ var EditorApi = (function() {
            xhr.setRequestHeader('Content-Type', 'application/json');
            xhr.onreadystatechange = function() {
                if (xhr.readyState !== 4) return;
                if (xhr.status === 401) {
                    // Not authenticated — redirect to login
                    window.location.href = '/login.html';
                    return;
                }
                if (xhr.status >= 200 && xhr.status < 300) {
                    try {
                        resolve(JSON.parse(xhr.responseText));
@@ -38,6 +43,21 @@ var EditorApi = (function() {
    }

    return {
        login: function(username, password) {
            return request('POST', '/api/login', {
                username: username,
                password: password
            });
        },

        logout: function() {
            return request('POST', '/api/logout');
        },

        authCheck: function() {
            return request('GET', '/api/auth-check');
        },

        getPlugins: function() {
            return request('GET', '/api/plugins');
        },
+8 −0
Original line number Diff line number Diff line
@@ -126,6 +126,14 @@
        document.getElementById('btn-refresh-preview').addEventListener('click', function() {
            Preview.refresh();
        });

        document.getElementById('btn-logout').addEventListener('click', function() {
            EditorApi.logout().then(function() {
                window.location.href = '/login.html';
            }).catch(function() {
                window.location.href = '/login.html';
            });
        });
    }

    // --- Tree action bindings ---
Loading