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)
|