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

test

parent 08ed7d2b
Loading
Loading
Loading
Loading
Loading
+14 −6
Changes for data/admin.html: 14 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ function filterOptions(selid, query) {
}

/* ---- Domain Selector ---- */
function loadDomainSelector(callback) {
function loadDomainSelector(callback, excludeAdmin) {
    ajaxGet("/settings/" + currentDomain + "/api/checkpermissions", function(perr, pdata) {
        var isSuperAdmin = (!perr && pdata && pdata.superadmin);

@@ -220,14 +220,18 @@ function loadDomainSelector(callback) {

        // SuperAdmins: show full domain selector
        ajaxGet("/settings/" + currentDomain + "/api/listdomains", function(err, data) {
            var domains = (!err && data && data.domains) ? data.domains : [];
            // views that only make sense for real domains (e.g. Computers) hide
            // admin.local and fall back to the first real domain
            if (excludeAdmin && currentDomain === "admin")
                currentDomain = domains.length ? domains[0].id : "admin";
            var sel = '<form id="domainform"><select id="domaindid" onchange="changeDomain(this.value)">';
            if (!excludeAdmin)
                sel += '<option value="admin"' + (currentDomain === "admin" ? ' selected' : '') + '>admin.local</option>';
            if (!err && data && data.domains) {
                for (var i = 0; i < data.domains.length; i++) {
                    var d = data.domains[i];
            for (var i = 0; i < domains.length; i++) {
                var d = domains[i];
                sel += '<option value="' + d.id + '"' + (currentDomain === d.id ? ' selected' : '') + '>' + d.name + '</option>';
            }
            }
            sel += '</select></form>';
            document.getElementById("domain-select").innerHTML = sel;
            if (callback) callback();
@@ -368,6 +372,10 @@ function loadComputers() {
    currentView = loadComputers;
    setActiveNav('nav-computers');
    loadDomainSelector(function() {
        if (currentDomain === "admin") {
            setContent('<h3>Computers</h3><p class="hint">Computer-Konten gibt es nur in echten Domänen, nicht in admin.local.</p>');
            return;
        }
        ajaxGet("/settings/" + currentDomain + "/api/listcomputers", function(err, data) {
            if (err) { showError(err); return; }
            var html = '<h3>Computers</h3>';
@@ -388,7 +396,7 @@ function loadComputers() {
            html += '</table>';
            setContent(html);
        });
    });
    }, true);
}

function removeComputer(cid) {
+10 −3
Changes for src/fenrirds.cpp: 10 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -673,8 +673,10 @@ namespace fenrirds {
                            if (g_AdPlugin->dirGet(dnName, uid, e, err)) {
                                std::string tp = e.str("thumbnailPhoto");
                                if (!tp.empty()) {
                                    std::vector<char> ph(tp.begin(), tp.end());
                                    rep.setState(HTTP200);
                                    rep.setContentType("image/jpeg");
                                    rep.send(curreq, tp.data(), tp.size());
                                    rep.send(curreq, ph, ph.size());
                                    return;
                                }
                            }
@@ -683,9 +685,14 @@ namespace fenrirds {
                }
            } catch (...) {}

            /* 3. fallback: the built-in default avatar */
            /* 3. fallback: the built-in default avatar. Send it as a byte
             * vector (same path the native avatar uses) so the full binary is
             * written — a const char* overload could stop at the first NUL. */
            std::vector<char> def(reinterpret_cast<const char*>(profile_webp),
                                  reinterpret_cast<const char*>(profile_webp) + sizeof(profile_webp));
            rep.setState(HTTP200);
            rep.setContentType("image/webp");
            rep.send(curreq, reinterpret_cast<const char*>(profile_webp), sizeof(profile_webp));
            rep.send(curreq, def, def.size());
        };

        AuthBackend *getDomainBackend(const ::uuid::uuid &did){