Fossil SCM

Try to always use /ckout as the start page for "fossil ui" invocations, even on remote hosts, unless something else is specified by the user.

drh 2024-12-10 18:18 trunk
Commit 58849c4098eadb17b2083bc98050c8b043699fffcd378a0a5fc49094e837f5e8
2 files changed +1 -1 +12 -9
+1 -1
--- src/info.c
+++ src/info.c
@@ -620,11 +620,11 @@
620620
int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
621621
DiffConfig DCfg,*pCfg; /* Diff details */
622622
Stmt q;
623623
624624
if( zName || !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){
625
- webpage_notfound_error(0 /*works-like:""*/);
625
+ cgi_redirect("%R/home");
626626
return;
627627
}
628628
diffType = preferred_diff_type();
629629
pCfg = construct_diff_flags(diffType, &DCfg);
630630
vid = db_lget_int("checkout", 0);
631631
--- src/info.c
+++ src/info.c
@@ -620,11 +620,11 @@
620 int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
621 DiffConfig DCfg,*pCfg; /* Diff details */
622 Stmt q;
623
624 if( zName || !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){
625 webpage_notfound_error(0 /*works-like:""*/);
626 return;
627 }
628 diffType = preferred_diff_type();
629 pCfg = construct_diff_flags(diffType, &DCfg);
630 vid = db_lget_int("checkout", 0);
631
--- src/info.c
+++ src/info.c
@@ -620,11 +620,11 @@
620 int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
621 DiffConfig DCfg,*pCfg; /* Diff details */
622 Stmt q;
623
624 if( zName || !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){
625 cgi_redirect("%R/home");
626 return;
627 }
628 diffType = preferred_diff_type();
629 pCfg = construct_diff_flags(diffType, &DCfg);
630 vid = db_lget_int("checkout", 0);
631
+12 -9
--- src/main.c
+++ src/main.c
@@ -2040,20 +2040,27 @@
20402040
*/
20412041
set_base_url(0);
20422042
if( fossil_redirect_to_https_if_needed(2) ) return;
20432043
if( zPathInfo==0 || zPathInfo[0]==0
20442044
|| (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
2045
- /* Second special case: If the PATH_INFO is blank, issue a redirect to
2046
- ** the home page identified by the "index-page" setting in the repository
2047
- ** CONFIG table, to "/index" if there no "index-page" setting. */
2045
+ /* Second special case: If the PATH_INFO is blank, issue a redirect:
2046
+ ** (1) to "/ckout" if g.useLocalauth and g.localOpen are both set.
2047
+ ** (2) to the home page identified by the "index-page" setting
2048
+ ** in the repository CONFIG table
2049
+ ** (3) to "/index" if there no "index-page" setting in CONFIG
2050
+ */
20482051
#ifdef FOSSIL_ENABLE_JSON
20492052
if(g.json.isJsonMode){
20502053
json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,1);
20512054
fossil_exit(0);
20522055
}
20532056
#endif
2054
- fossil_redirect_home() /*does not return*/;
2057
+ if( g.useLocalauth && g.localOpen ){
2058
+ cgi_redirectf("%R/ckout");
2059
+ }else{
2060
+ fossil_redirect_home() /*does not return*/;
2061
+ }
20552062
}else{
20562063
zPath = mprintf("%s", zPathInfo);
20572064
}
20582065
20592066
/* Make g.zPath point to the first element of the path. Make
@@ -3384,15 +3391,11 @@
33843391
}
33853392
if( !zRemote ){
33863393
find_server_repository(findServerArg, fCreate);
33873394
}
33883395
if( zInitPage==0 ){
3389
- if( isUiCmd && g.localOpen ){
3390
- zInitPage = "ckout";
3391
- }else{
3392
- zInitPage = "";
3393
- }
3396
+ zInitPage = "";
33943397
}
33953398
if( zPort ){
33963399
if( strchr(zPort,':') ){
33973400
int i;
33983401
for(i=strlen(zPort)-1; i>=0 && zPort[i]!=':'; i--){}
33993402
--- src/main.c
+++ src/main.c
@@ -2040,20 +2040,27 @@
2040 */
2041 set_base_url(0);
2042 if( fossil_redirect_to_https_if_needed(2) ) return;
2043 if( zPathInfo==0 || zPathInfo[0]==0
2044 || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
2045 /* Second special case: If the PATH_INFO is blank, issue a redirect to
2046 ** the home page identified by the "index-page" setting in the repository
2047 ** CONFIG table, to "/index" if there no "index-page" setting. */
 
 
 
2048 #ifdef FOSSIL_ENABLE_JSON
2049 if(g.json.isJsonMode){
2050 json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,1);
2051 fossil_exit(0);
2052 }
2053 #endif
2054 fossil_redirect_home() /*does not return*/;
 
 
 
 
2055 }else{
2056 zPath = mprintf("%s", zPathInfo);
2057 }
2058
2059 /* Make g.zPath point to the first element of the path. Make
@@ -3384,15 +3391,11 @@
3384 }
3385 if( !zRemote ){
3386 find_server_repository(findServerArg, fCreate);
3387 }
3388 if( zInitPage==0 ){
3389 if( isUiCmd && g.localOpen ){
3390 zInitPage = "ckout";
3391 }else{
3392 zInitPage = "";
3393 }
3394 }
3395 if( zPort ){
3396 if( strchr(zPort,':') ){
3397 int i;
3398 for(i=strlen(zPort)-1; i>=0 && zPort[i]!=':'; i--){}
3399
--- src/main.c
+++ src/main.c
@@ -2040,20 +2040,27 @@
2040 */
2041 set_base_url(0);
2042 if( fossil_redirect_to_https_if_needed(2) ) return;
2043 if( zPathInfo==0 || zPathInfo[0]==0
2044 || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
2045 /* Second special case: If the PATH_INFO is blank, issue a redirect:
2046 ** (1) to "/ckout" if g.useLocalauth and g.localOpen are both set.
2047 ** (2) to the home page identified by the "index-page" setting
2048 ** in the repository CONFIG table
2049 ** (3) to "/index" if there no "index-page" setting in CONFIG
2050 */
2051 #ifdef FOSSIL_ENABLE_JSON
2052 if(g.json.isJsonMode){
2053 json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,1);
2054 fossil_exit(0);
2055 }
2056 #endif
2057 if( g.useLocalauth && g.localOpen ){
2058 cgi_redirectf("%R/ckout");
2059 }else{
2060 fossil_redirect_home() /*does not return*/;
2061 }
2062 }else{
2063 zPath = mprintf("%s", zPathInfo);
2064 }
2065
2066 /* Make g.zPath point to the first element of the path. Make
@@ -3384,15 +3391,11 @@
3391 }
3392 if( !zRemote ){
3393 find_server_repository(findServerArg, fCreate);
3394 }
3395 if( zInitPage==0 ){
3396 zInitPage = "";
 
 
 
 
3397 }
3398 if( zPort ){
3399 if( strchr(zPort,':') ){
3400 int i;
3401 for(i=strlen(zPort)-1; i>=0 && zPort[i]!=':'; i--){}
3402

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button