File tree 5 files changed +12
-4
lines changed
5 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ let config = {};
25
25
// Static defaults
26
26
config . servers = [ ] ;
27
27
28
+ // Will disable the auto-generated temp users. If a user lands on the site, they will be required to sign up or log in.
29
+ config . disable_temp_users = false ;
30
+
28
31
config . max_file_size = 100_000_000_000 ,
29
32
config . max_thumb_size = 1_000 ,
30
33
config . max_fsentry_name_length = 767 ,
@@ -131,7 +134,6 @@ const config_pointer = {};
131
134
config_to_export = config_pointer ;
132
135
}
133
136
134
-
135
137
// We have some methods that can be called on `config`
136
138
{
137
139
// Add configuration values with precedence over the current config
Original file line number Diff line number Diff line change @@ -100,10 +100,12 @@ module.exports = eggspress(['/signup'], {
100
100
}
101
101
102
102
// temporary user
103
- if ( req . body . is_temp ) {
103
+ if ( req . body . is_temp && ! config . disable_temp_users ) {
104
104
req . body . username = await generate_random_username ( ) ;
105
105
req . body . email = req . body . username + '@gmail.com' ;
106
106
req . body . password = 'sadasdfasdfsadfsa' ;
107
+ } else if ( config . disable_temp_users ) {
108
+ return res . status ( 400 ) . send ( 'Temp users are disabled.' ) ;
107
109
}
108
110
109
111
// send_confirmation_code
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ class PuterHomepageService extends BaseService {
108
108
require_email_verification_to_publish_website : config . require_email_verification_to_publish_website ,
109
109
short_description : config . short_description ,
110
110
long_description : config . long_description ,
111
+ disable_temp_users : config . disable_temp_users ,
111
112
} ,
112
113
} ) ) ;
113
114
}
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ window.puter_gui_enabled = true;
31
31
* @param {string } [options.api_origin='https://api.puter.com'] - The origin URL for the API.
32
32
* @param {number } [options.max_item_name_length=500] - Maximum allowed length for an item name.
33
33
* @param {boolean } [options.require_email_verification_to_publish_website=true] - Flag to decide whether email verification is required to publish a website.
34
+ * @param {boolean } [options.disable_temp_users=false] - Flag to disable auto-generated temporary users.
34
35
*
35
36
* @property {string } [options.app_domain] - Extracted domain name from gui_origin. It's derived automatically if not provided.
36
37
* @property {string } [window.gui_env] - The environment in which the GUI is running (e.g., "dev" or "prod").
@@ -54,6 +55,7 @@ window.gui = async function(options){
54
55
window . api_origin = options . api_origin ?? "https://api.puter.com" ;
55
56
window . max_item_name_length = options . max_item_name_length ?? 500 ;
56
57
window . require_email_verification_to_publish_website = options . require_email_verification_to_publish_website ?? true ;
58
+ window . disable_temp_users = options . disable_temp_users ?? false ;
57
59
58
60
// DEV: Load the initgui.js file if we are in development mode
59
61
if ( ! window . gui_env || window . gui_env === "dev" ) {
@@ -73,6 +75,7 @@ window.gui = async function(options){
73
75
74
76
// 🚀 Launch the GUI 🚀
75
77
window . initgui ( options ) ;
78
+
76
79
}
77
80
78
81
/**
Original file line number Diff line number Diff line change @@ -831,7 +831,7 @@ window.initgui = async function(options){
831
831
// -------------------------------------------------------------------------------------
832
832
// Un-authed but not first visit -> try to log in/sign up
833
833
// -------------------------------------------------------------------------------------
834
- if ( ! window . is_auth ( ) && ! window . first_visit_ever ) {
834
+ if ( ! window . is_auth ( ) && ( ! window . first_visit_ever || window . disable_temp_users ) ) {
835
835
if ( window . logged_in_users . length > 0 ) {
836
836
UIWindowSessionList ( ) ;
837
837
}
@@ -849,7 +849,7 @@ window.initgui = async function(options){
849
849
// -------------------------------------------------------------------------------------
850
850
// Un-authed and first visit ever -> create temp user
851
851
// -------------------------------------------------------------------------------------
852
- else if ( ! window . is_auth ( ) && window . first_visit_ever ) {
852
+ else if ( ! window . is_auth ( ) && window . first_visit_ever && ! window . disable_temp_users ) {
853
853
let referrer ;
854
854
try {
855
855
referrer = new URL ( window . location . href ) . pathname ;
You can’t perform that action at this time.
0 commit comments