Check-in [db69c47abd]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make "off" the preferred way to diable robot-restrict
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: db69c47abda94b61ea5df13633d3d69348f3bf43fdc5f55e09d81d6a7ccc2d8d
User & Date: drh 2025-08-19 10:37:36.624
Context
2025-08-19
10:57
Check to see that CSS has been loaded before activating hyperlinks if the user is "nobody". check-in: 3f6a6bdce4 user: drh tags: trunk
10:37
Make "off" the preferred way to diable robot-restrict check-in: db69c47abd user: drh tags: trunk
10:28
Documentation update: Make the robot-restrict setting "none" or "off" to disable all restrictions. check-in: 26a9b03336 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/robot.c.
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
** The "diff" tag covers all diffing pages such as /vdiff, /fdiff, and
** /vpatch.  The "annotate" tag also covers /blame and /praise.  "zip"
** also covers /tarball and /sqlar.  If a tag has an "X" character appended,
** then it only applies if query parameters are such that the page is
** particularly difficult to compute. In all other case, the tag should
** exactly match the page name.
**
** Make this setting "none" or "off" to disable all robot restrictions.
*/

/*
** Return the default restriction GLOB
*/
const char *robot_restrict_default(void){
  return "timelineX,diff,annotate,zip,fileage,file";







|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
** The "diff" tag covers all diffing pages such as /vdiff, /fdiff, and
** /vpatch.  The "annotate" tag also covers /blame and /praise.  "zip"
** also covers /tarball and /sqlar.  If a tag has an "X" character appended,
** then it only applies if query parameters are such that the page is
** particularly difficult to compute. In all other case, the tag should
** exactly match the page name.
**
** Change this setting "off" to disable all robot restrictions.
*/

/*
** Return the default restriction GLOB
*/
const char *robot_restrict_default(void){
  return "timelineX,diff,annotate,zip,fileage,file";
180
181
182
183
184
185
186
187



188
189
190
191
192
193
194
int robot_restrict(const char *zPage){
  const char *zGlob;
  const char *zToken;
  static int bKnownPass = 0;
  if( g.zLogin ) return 0;    /* Logged in users always get through */
  if( bKnownPass ) return 0;  /* Already known to pass robot restrictions */
  zGlob = db_get("robot-restrict",robot_restrict_default());
  if( zGlob==0 || zGlob[0]==0 ){ bKnownPass = 1;  return 0; }



  if( !glob_multi_match(zGlob, zPage) ) return 0;
  zToken = P("token");
  if( zToken!=0
   && db_exists("SELECT 1 FROM config"
                " WHERE name='token-%q'"
                "   AND json_valid(value,6)"
                "   AND value->>'user' IS NOT NULL", zToken)







|
>
>
>







180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
int robot_restrict(const char *zPage){
  const char *zGlob;
  const char *zToken;
  static int bKnownPass = 0;
  if( g.zLogin ) return 0;    /* Logged in users always get through */
  if( bKnownPass ) return 0;  /* Already known to pass robot restrictions */
  zGlob = db_get("robot-restrict",robot_restrict_default());
  if( zGlob==0 || zGlob[0]==0 || fossil_strcmp(zGlob, "off")==0 ){
    bKnownPass = 1;
    return 0;   /* Robot restriction is turned off */
  }
  if( !glob_multi_match(zGlob, zPage) ) return 0;
  zToken = P("token");
  if( zToken!=0
   && db_exists("SELECT 1 FROM config"
                " WHERE name='token-%q'"
                "   AND json_valid(value,6)"
                "   AND value->>'user' IS NOT NULL", zToken)
Changes to src/setup.c.
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
  @ The "diff" tag covers all diffing pages such as /vdiff, /fdiff, and 
  @ /vpatch.  The "annotate" tag covers /annotate and also /blame and
  @ /praise.  The "zip" covers itself and also /tarball and /sqlar. If a
  @ tag has an "X" character appended, then it only applies if query
  @ parameters are such that the page is particularly difficult to compute.
  @ In all other case, the tag should exactly match the page name.
  @
  @ To disable robot restrictions, make this setting "none" or "off".
  @ (Property: robot-restrict)
  @ <br>
  textarea_attribute("", 2, 80,
      "robot-restrict", "rbrestrict", robot_restrict_default(), 0);

  @ <hr>
  addAutoHyperlinkSettings();







|







509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
  @ The "diff" tag covers all diffing pages such as /vdiff, /fdiff, and 
  @ /vpatch.  The "annotate" tag covers /annotate and also /blame and
  @ /praise.  The "zip" covers itself and also /tarball and /sqlar. If a
  @ tag has an "X" character appended, then it only applies if query
  @ parameters are such that the page is particularly difficult to compute.
  @ In all other case, the tag should exactly match the page name.
  @
  @ To disable robot restrictions, change this setting to "off".
  @ (Property: robot-restrict)
  @ <br>
  textarea_attribute("", 2, 80,
      "robot-restrict", "rbrestrict", robot_restrict_default(), 0);

  @ <hr>
  addAutoHyperlinkSettings();