mirror of
https://github.com/HeyPuter/puter.git
synced 2026-01-06 05:00:29 -06:00
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -70,6 +70,9 @@ async function UIWindowLogin(options){
|
||||
h += `</form>`;
|
||||
h += `</div>`;
|
||||
// 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 += `<div class="c2a-wrapper" style="padding:20px;">`;
|
||||
h += `<button class="signup-c2a-clickable">${i18n('create_free_account')}</button>`;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user