# 私信管理员可访问，前提是管理员拥有链接

**URL:** <https://meta.discourse.org/t/pms-are-accesible-by-admins-if-the-admin-has-the-link/123139>\
**Category:** Feature\
**Created:** [2019 年7 月 16 日 22:13 UTC](https://meta.discourse.org/t/pms-are-accesible-by-admins-if-the-admin-has-the-link/123139 "2019-07-16T22:13:57Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

作者： ![orangeandblack5](https://avatars.discourse-cdn.com/v4/letter/o/edb3f5/32.png) [@orangeandblack5](https://meta.discourse.org/u/orangeandblack5)\
发布日期： [2021 年12 月 2 日 22:55 UTC](https://meta.discourse.org/t/pms-are-accesible-by-admins-if-the-admin-has-the-link/123139/13 "2021-12-02T22:55:26Z")

</div>

这_极其_粗糙，但以下方法似乎通过强制 JavaScript 函数延迟 1/20 秒来起作用：

```plaintext

    api.onPageChange(() => {
        window.onload = determineUser();
    });

    async function determineUser() {
        await sleep(50);
        var pageURL = document.querySelector("meta[property='og:url']").getAttribute("content");
        var userPage = pageURL.includes("https://www.fortressoflies.com/u/");
        document.documentElement.style.setProperty('--currUsername', pageURL);
        if (userPage)
        {
            document.documentElement.style.setProperty('--lastUsername', pageURL);
        }
    }

    function sleep(ms)
    {
        return new Promise(resolve => setTimeout(resolve, ms));
    }

```

看看我是否能让它按预期工作。

---

_[View the full topic](https://meta.discourse.org/t/pms-are-accesible-by-admins-if-the-admin-has-the-link/123139)._
