diff --git a/src/backend/src/services/PuterHomepageService.js b/src/backend/src/services/PuterHomepageService.js index 551864052..d5adb7846 100644 --- a/src/backend/src/services/PuterHomepageService.js +++ b/src/backend/src/services/PuterHomepageService.js @@ -20,6 +20,7 @@ const { PathBuilder } = require("../util/pathutil"); const BaseService = require("./BaseService"); const {is_valid_url} = require('../helpers'); +const { Endpoint } = require("../util/expressutil"); /** * PuterHomepageService serves the initial HTML page that loads the Puter GUI @@ -66,6 +67,20 @@ class PuterHomepageService extends BaseService { } + async ['__on_install.routes'] (_, { app }) { + Endpoint({ + route: '/whoarewe', + methods: ['GET'], + handler: async (req, res) => { + res.json({ + disable_user_signup: this.global_config.disable_user_signup, + disable_temp_users: this.global_config.disable_temp_users, + }); + } + }).attach(app); + } + + /** * This method sends the initial HTML page that loads the Puter GUI and its assets. */ diff --git a/src/gui/src/UI/UIWindowLogin.js b/src/gui/src/UI/UIWindowLogin.js index 1447cc4ae..148eef471 100644 --- a/src/gui/src/UI/UIWindowLogin.js +++ b/src/gui/src/UI/UIWindowLogin.js @@ -70,6 +70,9 @@ async function UIWindowLogin(options){ h += ``; h += ``; // create account link + + // If show_signup_button is undefined, the default behavior is to show it. + // If show_signup_button is set to false, the button will not be shown. if(options.show_signup_button === undefined || options.show_signup_button){ h += `
`; h += ``; diff --git a/src/gui/src/initgui.js b/src/gui/src/initgui.js index 0b540de66..a7c52898c 100644 --- a/src/gui/src/initgui.js +++ b/src/gui/src/initgui.js @@ -790,9 +790,13 @@ window.initgui = async function(options){ UIWindowSessionList(); } else{ + const resp = await fetch(puter.defaultGUIOrigin + '/whoarewe'); + const whoarewe = await resp.json(); await UIWindowLogin({ + // show_signup_button: reload_on_success: true, send_confirmation_code: false, + show_signup_button: ( ! whoarewe.disable_user_signup ), window_options:{ has_head: false }