File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 2020const { PathBuilder } = require ( "../util/pathutil" ) ;
2121const BaseService = require ( "./BaseService" ) ;
2222const { is_valid_url} = require ( '../helpers' ) ;
23+ const { Endpoint } = require ( "../util/expressutil" ) ;
2324
2425/**
2526 * PuterHomepageService serves the initial HTML page that loads the Puter GUI
@@ -66,6 +67,20 @@ class PuterHomepageService extends BaseService {
6667 }
6768
6869
70+ async [ '__on_install.routes' ] ( _ , { app } ) {
71+ Endpoint ( {
72+ route : '/whoarewe' ,
73+ methods : [ 'GET' ] ,
74+ handler : async ( req , res ) => {
75+ res . json ( {
76+ disable_user_signup : this . global_config . disable_user_signup ,
77+ disable_temp_users : this . global_config . disable_temp_users ,
78+ } ) ;
79+ }
80+ } ) . attach ( app ) ;
81+ }
82+
83+
6984 /**
7085 * This method sends the initial HTML page that loads the Puter GUI and its assets.
7186 */
Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ async function UIWindowLogin(options){
7070 h += `</form>` ;
7171 h += `</div>` ;
7272 // create account link
73+
74+ // If show_signup_button is undefined, the default behavior is to show it.
75+ // If show_signup_button is set to false, the button will not be shown.
7376 if ( options . show_signup_button === undefined || options . show_signup_button ) {
7477 h += `<div class="c2a-wrapper" style="padding:20px;">` ;
7578 h += `<button class="signup-c2a-clickable">${ i18n ( 'create_free_account' ) } </button>` ;
Original file line number Diff line number Diff line change @@ -790,9 +790,13 @@ window.initgui = async function(options){
790790 UIWindowSessionList ( ) ;
791791 }
792792 else {
793+ const resp = await fetch ( puter . defaultGUIOrigin + '/whoarewe' ) ;
794+ const whoarewe = await resp . json ( ) ;
793795 await UIWindowLogin ( {
796+ // show_signup_button:
794797 reload_on_success : true ,
795798 send_confirmation_code : false ,
799+ show_signup_button : ( ! whoarewe . disable_user_signup ) ,
796800 window_options :{
797801 has_head : false
798802 }
You can’t perform that action at this time.
0 commit comments