Fossil SCM

Exposed the redirect-to-https setting to the CLI and extended the definition of the SETTING.width property such that negative values tell /setup_settings not to render that setting (unlike most CLI-configurable settings, redirect-to-https is configured via /setup_access). Per request from https://fossil-scm.org/forum/forumpost/780138230c.

stephan 2019-12-04 11:45 trunk
Commit 45953a4ad0c1581ec8f9075ca094ec3954d9a6e89d0893abf175191598024f6f
3 files changed +15 -3 +1 +2 -2
+15 -3
--- src/db.c
+++ src/db.c
@@ -3078,20 +3078,25 @@
30783078
** command.
30793079
**
30803080
** var is the name of the internal configuration name for db_(un)set.
30813081
** If var is 0, the settings name is used.
30823082
**
3083
-** width is the length for the edit field on the behavior page, 0
3084
-** is used for on/off checkboxes.
3083
+** width is the length for the edit field on the behavior page, 0 is
3084
+** used for on/off checkboxes. A negative value indicates that that
3085
+** page should not render this setting. Such values may be rendered
3086
+** separately/manually on another page, e.g., /setup_access, and are
3087
+** exposed via the CLI settings command.
30853088
**
30863089
** The behaviour page doesn't use a special layout. It lists all
30873090
** set-commands and displays the 'set'-help as info.
30883091
*/
30893092
struct Setting {
30903093
const char *name; /* Name of the setting */
30913094
const char *var; /* Internal variable name used by db_set() */
3092
- int width; /* Width of display. 0 for boolean values. */
3095
+ int width; /* Width of display. 0 for boolean values and
3096
+ ** negative for values which should not appear
3097
+ ** on the /setup_settings page. */
30933098
int versionable; /* Is this setting versionable? */
30943099
int forceTextArea; /* Force using a text area for display? */
30953100
const char *def; /* Default value */
30963101
};
30973102
#endif /* INTERFACE */
@@ -3466,10 +3471,17 @@
34663471
** URL of the HTTP proxy. If undefined or "off" then
34673472
** the "http_proxy" environment variable is consulted.
34683473
** If the http_proxy environment variable is undefined
34693474
** then a direct HTTP connection is used.
34703475
*/
3476
+/*
3477
+** SETTING: redirect-to-https default=0 width=-1
3478
+** Specifies whether or not to redirect http:// requests to
3479
+** https:// URIs. A value of 0 (the default) means not to
3480
+** redirect, 1 means to redirect only the /login page, and 2
3481
+** means to always redirect.
3482
+*/
34713483
/*
34723484
** SETTING: relative-paths boolean default=on
34733485
** When showing changes and extras, report paths relative
34743486
** to the current working directory.
34753487
*/
34763488
--- src/db.c
+++ src/db.c
@@ -3078,20 +3078,25 @@
3078 ** command.
3079 **
3080 ** var is the name of the internal configuration name for db_(un)set.
3081 ** If var is 0, the settings name is used.
3082 **
3083 ** width is the length for the edit field on the behavior page, 0
3084 ** is used for on/off checkboxes.
 
 
 
3085 **
3086 ** The behaviour page doesn't use a special layout. It lists all
3087 ** set-commands and displays the 'set'-help as info.
3088 */
3089 struct Setting {
3090 const char *name; /* Name of the setting */
3091 const char *var; /* Internal variable name used by db_set() */
3092 int width; /* Width of display. 0 for boolean values. */
 
 
3093 int versionable; /* Is this setting versionable? */
3094 int forceTextArea; /* Force using a text area for display? */
3095 const char *def; /* Default value */
3096 };
3097 #endif /* INTERFACE */
@@ -3466,10 +3471,17 @@
3466 ** URL of the HTTP proxy. If undefined or "off" then
3467 ** the "http_proxy" environment variable is consulted.
3468 ** If the http_proxy environment variable is undefined
3469 ** then a direct HTTP connection is used.
3470 */
 
 
 
 
 
 
 
3471 /*
3472 ** SETTING: relative-paths boolean default=on
3473 ** When showing changes and extras, report paths relative
3474 ** to the current working directory.
3475 */
3476
--- src/db.c
+++ src/db.c
@@ -3078,20 +3078,25 @@
3078 ** command.
3079 **
3080 ** var is the name of the internal configuration name for db_(un)set.
3081 ** If var is 0, the settings name is used.
3082 **
3083 ** width is the length for the edit field on the behavior page, 0 is
3084 ** used for on/off checkboxes. A negative value indicates that that
3085 ** page should not render this setting. Such values may be rendered
3086 ** separately/manually on another page, e.g., /setup_access, and are
3087 ** exposed via the CLI settings command.
3088 **
3089 ** The behaviour page doesn't use a special layout. It lists all
3090 ** set-commands and displays the 'set'-help as info.
3091 */
3092 struct Setting {
3093 const char *name; /* Name of the setting */
3094 const char *var; /* Internal variable name used by db_set() */
3095 int width; /* Width of display. 0 for boolean values and
3096 ** negative for values which should not appear
3097 ** on the /setup_settings page. */
3098 int versionable; /* Is this setting versionable? */
3099 int forceTextArea; /* Force using a text area for display? */
3100 const char *def; /* Default value */
3101 };
3102 #endif /* INTERFACE */
@@ -3466,10 +3471,17 @@
3471 ** URL of the HTTP proxy. If undefined or "off" then
3472 ** the "http_proxy" environment variable is consulted.
3473 ** If the http_proxy environment variable is undefined
3474 ** then a direct HTTP connection is used.
3475 */
3476 /*
3477 ** SETTING: redirect-to-https default=0 width=-1
3478 ** Specifies whether or not to redirect http:// requests to
3479 ** https:// URIs. A value of 0 (the default) means not to
3480 ** redirect, 1 means to redirect only the /login page, and 2
3481 ** means to always redirect.
3482 */
3483 /*
3484 ** SETTING: relative-paths boolean default=on
3485 ** When showing changes and extras, report paths relative
3486 ** to the current working directory.
3487 */
3488
--- src/mkindex.c
+++ src/mkindex.c
@@ -513,10 +513,11 @@
513513
nUsed = nFixed;
514514
}
515515
516516
int main(int argc, char **argv){
517517
int i;
518
+ memset(aEntry, 0, sizeof(Entry) * N_ENTRY);
518519
for(i=1; i<argc; i++){
519520
zFile = argv[i];
520521
process_file();
521522
}
522523
build_table();
523524
--- src/mkindex.c
+++ src/mkindex.c
@@ -513,10 +513,11 @@
513 nUsed = nFixed;
514 }
515
516 int main(int argc, char **argv){
517 int i;
 
518 for(i=1; i<argc; i++){
519 zFile = argv[i];
520 process_file();
521 }
522 build_table();
523
--- src/mkindex.c
+++ src/mkindex.c
@@ -513,10 +513,11 @@
513 nUsed = nFixed;
514 }
515
516 int main(int argc, char **argv){
517 int i;
518 memset(aEntry, 0, sizeof(Entry) * N_ENTRY);
519 for(i=1; i<argc; i++){
520 zFile = argv[i];
521 process_file();
522 }
523 build_table();
524
+2 -2
--- src/setup.c
+++ src/setup.c
@@ -840,11 +840,11 @@
840840
}
841841
}
842842
@ <br /><input type="submit" name="submit" value="Apply Changes" />
843843
@ </td><td style="width:50px;"></td><td valign="top">
844844
for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
845
- if( pSet->width!=0 && !pSet->forceTextArea ){
845
+ if( pSet->width>0 && !pSet->forceTextArea ){
846846
int hasVersionableValue = pSet->versionable &&
847847
(db_get_versioned(pSet->name, NULL)!=0);
848848
entry_attribute("", /*pSet->width*/ 25, pSet->name,
849849
pSet->var!=0 ? pSet->var : pSet->name,
850850
(char*)pSet->def, hasVersionableValue);
@@ -856,11 +856,11 @@
856856
}
857857
}
858858
}
859859
@ </td><td style="width:50px;"></td><td valign="top">
860860
for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
861
- if( pSet->width!=0 && pSet->forceTextArea ){
861
+ if( pSet->width>0 && pSet->forceTextArea ){
862862
int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
863863
@ <a href='%R/help?cmd=%s(pSet->name)'>%s(pSet->name)</a>
864864
if( pSet->versionable ){
865865
@ (v)<br />
866866
} else {
867867
--- src/setup.c
+++ src/setup.c
@@ -840,11 +840,11 @@
840 }
841 }
842 @ <br /><input type="submit" name="submit" value="Apply Changes" />
843 @ </td><td style="width:50px;"></td><td valign="top">
844 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
845 if( pSet->width!=0 && !pSet->forceTextArea ){
846 int hasVersionableValue = pSet->versionable &&
847 (db_get_versioned(pSet->name, NULL)!=0);
848 entry_attribute("", /*pSet->width*/ 25, pSet->name,
849 pSet->var!=0 ? pSet->var : pSet->name,
850 (char*)pSet->def, hasVersionableValue);
@@ -856,11 +856,11 @@
856 }
857 }
858 }
859 @ </td><td style="width:50px;"></td><td valign="top">
860 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
861 if( pSet->width!=0 && pSet->forceTextArea ){
862 int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
863 @ <a href='%R/help?cmd=%s(pSet->name)'>%s(pSet->name)</a>
864 if( pSet->versionable ){
865 @ (v)<br />
866 } else {
867
--- src/setup.c
+++ src/setup.c
@@ -840,11 +840,11 @@
840 }
841 }
842 @ <br /><input type="submit" name="submit" value="Apply Changes" />
843 @ </td><td style="width:50px;"></td><td valign="top">
844 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
845 if( pSet->width>0 && !pSet->forceTextArea ){
846 int hasVersionableValue = pSet->versionable &&
847 (db_get_versioned(pSet->name, NULL)!=0);
848 entry_attribute("", /*pSet->width*/ 25, pSet->name,
849 pSet->var!=0 ? pSet->var : pSet->name,
850 (char*)pSet->def, hasVersionableValue);
@@ -856,11 +856,11 @@
856 }
857 }
858 }
859 @ </td><td style="width:50px;"></td><td valign="top">
860 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
861 if( pSet->width>0 && pSet->forceTextArea ){
862 int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
863 @ <a href='%R/help?cmd=%s(pSet->name)'>%s(pSet->name)</a>
864 if( pSet->versionable ){
865 @ (v)<br />
866 } else {
867

Keyboard Shortcuts

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