2023-08-10 15:56:36 -07:00
|
|
|
import useSupport from "./useSupport";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SupportOnly only shows its contents to Support users. For most users, the
|
|
|
|
* content will be hidden!
|
|
|
|
*
|
|
|
|
* To become a Support user, you visit /?supportSecret=..., which saves the
|
|
|
|
* secret to your device.
|
|
|
|
*
|
|
|
|
* Note that this component doesn't check that the secret is *correct*, so it's
|
|
|
|
* possible to view this UI by faking an invalid secret. That's okay, because
|
|
|
|
* the server checks the provided secret for each Support request.
|
|
|
|
*/
|
|
|
|
function SupportOnly({ children }) {
|
2024-09-09 16:10:45 -07:00
|
|
|
const { isSupportUser } = useSupport();
|
|
|
|
return isSupportUser ? children : null;
|
2023-08-10 15:56:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export default SupportOnly;
|