Fossil SCM

json doc updates and removal of some dead code.

stephan 2011-11-05 01:28 trunk
Commit 0c234bdd0a64c1317143ce0469008fc9f79fbd03
--- ajax/js/fossil-ajaj.js
+++ ajax/js/fossil-ajaj.js
@@ -79,11 +79,12 @@
7979
However, this.ajaj.callbacks.onResponse() _is_ called for both (because
8080
it happens at a lower level).
8181
8282
If this object has an onLogin() function it is called (with
8383
no arguments) before the onResponse() handler of the login is called
84
- (that is the 2nd request for anonymous logins).
84
+ (that is the 2nd request for anonymous logins) and any exceptions
85
+ it throws are ignored.
8586
8687
*/
8788
FossilAjaj.prototype.login = function(name,pw,ajajOpt) {
8889
name = name || 'anonymous';
8990
var self = this;
9091
--- ajax/js/fossil-ajaj.js
+++ ajax/js/fossil-ajaj.js
@@ -79,11 +79,12 @@
79 However, this.ajaj.callbacks.onResponse() _is_ called for both (because
80 it happens at a lower level).
81
82 If this object has an onLogin() function it is called (with
83 no arguments) before the onResponse() handler of the login is called
84 (that is the 2nd request for anonymous logins).
 
85
86 */
87 FossilAjaj.prototype.login = function(name,pw,ajajOpt) {
88 name = name || 'anonymous';
89 var self = this;
90
--- ajax/js/fossil-ajaj.js
+++ ajax/js/fossil-ajaj.js
@@ -79,11 +79,12 @@
79 However, this.ajaj.callbacks.onResponse() _is_ called for both (because
80 it happens at a lower level).
81
82 If this object has an onLogin() function it is called (with
83 no arguments) before the onResponse() handler of the login is called
84 (that is the 2nd request for anonymous logins) and any exceptions
85 it throws are ignored.
86
87 */
88 FossilAjaj.prototype.login = function(name,pw,ajajOpt) {
89 name = name || 'anonymous';
90 var self = this;
91
+37 -30
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -94,11 +94,12 @@
9494
If the str argument is not passed (arguments.length==0) then
9595
window.location.search.substring(1) is used by default. If
9696
neither str is passed in nor window exists then false is returned.
9797
9898
On success it returns an Object containing the key/value pairs
99
- parsed from the string.
99
+ parsed from the string. Keys which have no value are treated
100
+ has having the boolean true value.
100101
101102
FIXME: for keys in the form "name[]", build an array of results,
102103
like PHP does.
103104
104105
*/
@@ -186,25 +187,29 @@
186187
object which act as wrappers for backend-specific functionality. As
187188
a simple example:
188189
189190
@code
190191
cgi.login = function(name,pw,ajajOpt) {
191
- this.sendRequest( {name:name, password:pw}, ajajOpt );
192
+ this.sendRequest(
193
+ {command:"json/login",
194
+ name:name,
195
+ password:pw
196
+ }, ajajOpt );
192197
};
193198
@endcode
194199
195200
TODOs:
196201
197202
- Caching of page-load requests, with a configurable lifetime.
198203
199
- - Use-cases like the above login() function are a tiny bit
200
- problematic to implement when each request has a different URL
201
- path (i know this from the whiki implementation). This is partly
202
- a side-effect of design descisions made back in the very first
203
- days of this code's life. i need to go through and see where i
204
- can bend those conventions a bit (where it won't break my other
205
- apps unduly).
204
+ - Use-cases like the above login() function are a tiny bit
205
+ problematic to implement when each request has a different URL
206
+ path (i know this from the whiki and fossil implementations).
207
+ This is partly a side-effect of design descisions made back in
208
+ the very first days of this code's life. i need to go through
209
+ and see where i can bend those conventions a bit (where it won't
210
+ break my other apps unduly).
206211
*/
207212
WhAjaj.Connector = function(opt)
208213
{
209214
if(WhAjaj.isObject(opt)) this.options = opt;
210215
//TODO?: this.$cache = {};
@@ -284,11 +289,11 @@
284289
not. Not all concrete WhAjaj.Connector.sendImpl()
285290
implementations can support this. Interestingly, at
286291
least one popular AJAX toolkit does not document
287292
supporting _synchronous_ AJAX operations. All common
288293
browser-side implementations support async operation, but
289
- non-browser implementations migth not.
294
+ non-browser implementations might not.
290295
*/
291296
asynchronous:true,
292297
293298
/**
294299
A HTTP authentication login name for the AJAX
@@ -310,28 +315,32 @@
310315
WhAjaj.Connector.sendImpl() implementations can support this.
311316
*/
312317
timeout:10000,
313318
314319
/**
315
- If an AJAJ request receives JSON data from the back-end, that
316
- data is passed as a plain Object as the response parameter
317
- (exception: in jsonp mode it is passed a string). The initiating
318
- request object is passed as the second parameter, but clients
319
- can normally ignore it (only those which need a way to map
320
- specific requests to responses will need it). The 3rd parameter
321
- is the same as the 'this' object for the context of the callback,
322
- but is provided because the instance-level callbacks (set in
323
- (WhAjaj.Connector instance).callbacks, require it in some
324
- cases (because their 'this' is different!).
325
-
326
- Note that the response might contain error information which
327
- comes from the back-end. The difference between this error info
328
- and the info passed to the onError() callback is that this data
329
- indicates an application-level error, whereas onError() is used
330
- to report connection-level problems or when the backend produces
331
- non-JSON data (which, when not in jsonp mode, is unexpected and
332
- is as fatal to the request as a connection error).
320
+ If an AJAJ request receives JSON data from the back-end,
321
+ that data is passed as a plain Object as the response
322
+ parameter (exception: in jsonp mode it is passed a
323
+ string (why???)). The initiating request object is
324
+ passed as the second parameter, but clients can normally
325
+ ignore it (only those which need a way to map specific
326
+ requests to responses will need it). The 3rd parameter
327
+ is the same as the 'this' object for the context of the
328
+ callback, but is provided because the instance-level
329
+ callbacks (set in (WhAjaj.Connector instance).callbacks,
330
+ require it in some cases (because their 'this' is
331
+ different!).
332
+
333
+ Note that the response might contain error information
334
+ which comes from the back-end. The difference between
335
+ this error info and the info passed to the onError()
336
+ callback is that this data indicates an
337
+ application-level error, whereas onError() is used to
338
+ report connection-level problems or when the backend
339
+ produces non-JSON data (which, when not in jsonp mode,
340
+ is unexpected and is as fatal to the request as a
341
+ connection error).
333342
*/
334343
onResponse: function(response, request, opt){},
335344
336345
/**
337346
If an AJAX request fails to establish a connection or it
@@ -760,12 +769,10 @@
760769
var timeout = args.timeout || 10000/*arbitrary!*/;
761770
var hitTimeout = false;
762771
var done = false;
763772
var tmid /* setTimeout() ID */;
764773
var whself = this;
765
- //if( json ) json = json.replace(/ö/g,"\\u00f6") /* ONLY FOR A SPECIFIC TEST */;
766
- //alert( 'json=\n'+json );
767774
function handleTimeout()
768775
{
769776
hitTimeout = true;
770777
if( ! done )
771778
{
772779
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -94,11 +94,12 @@
94 If the str argument is not passed (arguments.length==0) then
95 window.location.search.substring(1) is used by default. If
96 neither str is passed in nor window exists then false is returned.
97
98 On success it returns an Object containing the key/value pairs
99 parsed from the string.
 
100
101 FIXME: for keys in the form "name[]", build an array of results,
102 like PHP does.
103
104 */
@@ -186,25 +187,29 @@
186 object which act as wrappers for backend-specific functionality. As
187 a simple example:
188
189 @code
190 cgi.login = function(name,pw,ajajOpt) {
191 this.sendRequest( {name:name, password:pw}, ajajOpt );
 
 
 
 
192 };
193 @endcode
194
195 TODOs:
196
197 - Caching of page-load requests, with a configurable lifetime.
198
199 - Use-cases like the above login() function are a tiny bit
200 problematic to implement when each request has a different URL
201 path (i know this from the whiki implementation). This is partly
202 a side-effect of design descisions made back in the very first
203 days of this code's life. i need to go through and see where i
204 can bend those conventions a bit (where it won't break my other
205 apps unduly).
206 */
207 WhAjaj.Connector = function(opt)
208 {
209 if(WhAjaj.isObject(opt)) this.options = opt;
210 //TODO?: this.$cache = {};
@@ -284,11 +289,11 @@
284 not. Not all concrete WhAjaj.Connector.sendImpl()
285 implementations can support this. Interestingly, at
286 least one popular AJAX toolkit does not document
287 supporting _synchronous_ AJAX operations. All common
288 browser-side implementations support async operation, but
289 non-browser implementations migth not.
290 */
291 asynchronous:true,
292
293 /**
294 A HTTP authentication login name for the AJAX
@@ -310,28 +315,32 @@
310 WhAjaj.Connector.sendImpl() implementations can support this.
311 */
312 timeout:10000,
313
314 /**
315 If an AJAJ request receives JSON data from the back-end, that
316 data is passed as a plain Object as the response parameter
317 (exception: in jsonp mode it is passed a string). The initiating
318 request object is passed as the second parameter, but clients
319 can normally ignore it (only those which need a way to map
320 specific requests to responses will need it). The 3rd parameter
321 is the same as the 'this' object for the context of the callback,
322 but is provided because the instance-level callbacks (set in
323 (WhAjaj.Connector instance).callbacks, require it in some
324 cases (because their 'this' is different!).
325
326 Note that the response might contain error information which
327 comes from the back-end. The difference between this error info
328 and the info passed to the onError() callback is that this data
329 indicates an application-level error, whereas onError() is used
330 to report connection-level problems or when the backend produces
331 non-JSON data (which, when not in jsonp mode, is unexpected and
332 is as fatal to the request as a connection error).
 
 
 
 
333 */
334 onResponse: function(response, request, opt){},
335
336 /**
337 If an AJAX request fails to establish a connection or it
@@ -760,12 +769,10 @@
760 var timeout = args.timeout || 10000/*arbitrary!*/;
761 var hitTimeout = false;
762 var done = false;
763 var tmid /* setTimeout() ID */;
764 var whself = this;
765 //if( json ) json = json.replace(/ö/g,"\\u00f6") /* ONLY FOR A SPECIFIC TEST */;
766 //alert( 'json=\n'+json );
767 function handleTimeout()
768 {
769 hitTimeout = true;
770 if( ! done )
771 {
772
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -94,11 +94,12 @@
94 If the str argument is not passed (arguments.length==0) then
95 window.location.search.substring(1) is used by default. If
96 neither str is passed in nor window exists then false is returned.
97
98 On success it returns an Object containing the key/value pairs
99 parsed from the string. Keys which have no value are treated
100 has having the boolean true value.
101
102 FIXME: for keys in the form "name[]", build an array of results,
103 like PHP does.
104
105 */
@@ -186,25 +187,29 @@
187 object which act as wrappers for backend-specific functionality. As
188 a simple example:
189
190 @code
191 cgi.login = function(name,pw,ajajOpt) {
192 this.sendRequest(
193 {command:"json/login",
194 name:name,
195 password:pw
196 }, ajajOpt );
197 };
198 @endcode
199
200 TODOs:
201
202 - Caching of page-load requests, with a configurable lifetime.
203
204 - Use-cases like the above login() function are a tiny bit
205 problematic to implement when each request has a different URL
206 path (i know this from the whiki and fossil implementations).
207 This is partly a side-effect of design descisions made back in
208 the very first days of this code's life. i need to go through
209 and see where i can bend those conventions a bit (where it won't
210 break my other apps unduly).
211 */
212 WhAjaj.Connector = function(opt)
213 {
214 if(WhAjaj.isObject(opt)) this.options = opt;
215 //TODO?: this.$cache = {};
@@ -284,11 +289,11 @@
289 not. Not all concrete WhAjaj.Connector.sendImpl()
290 implementations can support this. Interestingly, at
291 least one popular AJAX toolkit does not document
292 supporting _synchronous_ AJAX operations. All common
293 browser-side implementations support async operation, but
294 non-browser implementations might not.
295 */
296 asynchronous:true,
297
298 /**
299 A HTTP authentication login name for the AJAX
@@ -310,28 +315,32 @@
315 WhAjaj.Connector.sendImpl() implementations can support this.
316 */
317 timeout:10000,
318
319 /**
320 If an AJAJ request receives JSON data from the back-end,
321 that data is passed as a plain Object as the response
322 parameter (exception: in jsonp mode it is passed a
323 string (why???)). The initiating request object is
324 passed as the second parameter, but clients can normally
325 ignore it (only those which need a way to map specific
326 requests to responses will need it). The 3rd parameter
327 is the same as the 'this' object for the context of the
328 callback, but is provided because the instance-level
329 callbacks (set in (WhAjaj.Connector instance).callbacks,
330 require it in some cases (because their 'this' is
331 different!).
332
333 Note that the response might contain error information
334 which comes from the back-end. The difference between
335 this error info and the info passed to the onError()
336 callback is that this data indicates an
337 application-level error, whereas onError() is used to
338 report connection-level problems or when the backend
339 produces non-JSON data (which, when not in jsonp mode,
340 is unexpected and is as fatal to the request as a
341 connection error).
342 */
343 onResponse: function(response, request, opt){},
344
345 /**
346 If an AJAX request fails to establish a connection or it
@@ -760,12 +769,10 @@
769 var timeout = args.timeout || 10000/*arbitrary!*/;
770 var hitTimeout = false;
771 var done = false;
772 var tmid /* setTimeout() ID */;
773 var whself = this;
 
 
774 function handleTimeout()
775 {
776 hitTimeout = true;
777 if( ! done )
778 {
779
+4 -4
--- src/json.c
+++ src/json.c
@@ -2208,20 +2208,20 @@
22082208
** Mapping of names to JSON pages/commands. Each name is a subpath of
22092209
** /json (in CGI mode) or a subcommand of the json command in CLI mode
22102210
*/
22112211
static const JsonPageDef JsonPageDefs[] = {
22122212
/* please keep alphabetically sorted (case-insensitive) for maintenance reasons. */
2213
-{"anonymousPassword", json_page_anon_password, 1},
2213
+{"anonymousPassword", json_page_anon_password, 0},
22142214
{"artifact", json_page_artifact, 0},
22152215
{"branch", json_page_branch,0},
22162216
{"cap", json_page_cap, 0},
22172217
{"diff", json_page_diff, 0},
22182218
{"dir", json_page_nyi, 0},
22192219
{"g", json_page_g, 0},
22202220
{"HAI",json_page_version,0},
2221
-{"login",json_page_login,1},
2222
-{"logout",json_page_logout,1},
2221
+{"login",json_page_login,0},
2222
+{"logout",json_page_logout,0},
22232223
{"query",json_page_query,0},
22242224
{"rebuild",json_page_rebuild,0},
22252225
{"report", json_page_report, 0},
22262226
{"resultCodes", json_page_resultCodes,0},
22272227
{"stat",json_page_stat,0},
@@ -2228,11 +2228,11 @@
22282228
{"tag", json_page_tag,0},
22292229
{"ticket", json_page_nyi,0},
22302230
{"timeline", json_page_timeline,0},
22312231
{"user",json_page_user,0},
22322232
{"version",json_page_version,0},
2233
-{"whoami",json_page_whoami,0/*FIXME: work in CLI mode*/},
2233
+{"whoami",json_page_whoami,0},
22342234
{"wiki",json_page_wiki,0},
22352235
/* Last entry MUST have a NULL name. */
22362236
{NULL,NULL,0}
22372237
};
22382238
22392239
--- src/json.c
+++ src/json.c
@@ -2208,20 +2208,20 @@
2208 ** Mapping of names to JSON pages/commands. Each name is a subpath of
2209 ** /json (in CGI mode) or a subcommand of the json command in CLI mode
2210 */
2211 static const JsonPageDef JsonPageDefs[] = {
2212 /* please keep alphabetically sorted (case-insensitive) for maintenance reasons. */
2213 {"anonymousPassword", json_page_anon_password, 1},
2214 {"artifact", json_page_artifact, 0},
2215 {"branch", json_page_branch,0},
2216 {"cap", json_page_cap, 0},
2217 {"diff", json_page_diff, 0},
2218 {"dir", json_page_nyi, 0},
2219 {"g", json_page_g, 0},
2220 {"HAI",json_page_version,0},
2221 {"login",json_page_login,1},
2222 {"logout",json_page_logout,1},
2223 {"query",json_page_query,0},
2224 {"rebuild",json_page_rebuild,0},
2225 {"report", json_page_report, 0},
2226 {"resultCodes", json_page_resultCodes,0},
2227 {"stat",json_page_stat,0},
@@ -2228,11 +2228,11 @@
2228 {"tag", json_page_tag,0},
2229 {"ticket", json_page_nyi,0},
2230 {"timeline", json_page_timeline,0},
2231 {"user",json_page_user,0},
2232 {"version",json_page_version,0},
2233 {"whoami",json_page_whoami,0/*FIXME: work in CLI mode*/},
2234 {"wiki",json_page_wiki,0},
2235 /* Last entry MUST have a NULL name. */
2236 {NULL,NULL,0}
2237 };
2238
2239
--- src/json.c
+++ src/json.c
@@ -2208,20 +2208,20 @@
2208 ** Mapping of names to JSON pages/commands. Each name is a subpath of
2209 ** /json (in CGI mode) or a subcommand of the json command in CLI mode
2210 */
2211 static const JsonPageDef JsonPageDefs[] = {
2212 /* please keep alphabetically sorted (case-insensitive) for maintenance reasons. */
2213 {"anonymousPassword", json_page_anon_password, 0},
2214 {"artifact", json_page_artifact, 0},
2215 {"branch", json_page_branch,0},
2216 {"cap", json_page_cap, 0},
2217 {"diff", json_page_diff, 0},
2218 {"dir", json_page_nyi, 0},
2219 {"g", json_page_g, 0},
2220 {"HAI",json_page_version,0},
2221 {"login",json_page_login,0},
2222 {"logout",json_page_logout,0},
2223 {"query",json_page_query,0},
2224 {"rebuild",json_page_rebuild,0},
2225 {"report", json_page_report, 0},
2226 {"resultCodes", json_page_resultCodes,0},
2227 {"stat",json_page_stat,0},
@@ -2228,11 +2228,11 @@
2228 {"tag", json_page_tag,0},
2229 {"ticket", json_page_nyi,0},
2230 {"timeline", json_page_timeline,0},
2231 {"user",json_page_user,0},
2232 {"version",json_page_version,0},
2233 {"whoami",json_page_whoami,0},
2234 {"wiki",json_page_wiki,0},
2235 /* Last entry MUST have a NULL name. */
2236 {NULL,NULL,0}
2237 };
2238
2239
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -234,16 +234,10 @@
234234
cson_object * pay = NULL;
235235
const char *zMime;
236236
Blob content = empty_blob;
237237
Stmt q = empty_Stmt;
238238
cson_array * checkin_arr = NULL;
239
-#if 0
240
- /*see next #if block below*/
241
- cson_string * tagKey = NULL;
242
- cson_value * checkinV = NULL;
243
- cson_object * checkin = NULL;
244
-#endif
245239
246240
if( ! g.perm.Read ){
247241
json_set_err(FSL_JSON_E_DENIED,
248242
"Requires 'o' privileges.");
249243
return NULL;
@@ -269,13 +263,14 @@
269263
db_prepare(&q,
270264
"SELECT filename.name AS name, "
271265
" cast(strftime('%%s',event.mtime) as int) AS mtime,"
272266
" coalesce(event.ecomment,event.comment) as comment,"
273267
" coalesce(event.euser,event.user) as user,"
274
- " b.uuid as uuid, mlink.mperm as mperm,"/* WTF is mperm?*/
268
+ " b.uuid as uuid, mlink.mperm as mperm,"
275269
" coalesce((SELECT value FROM tagxref"
276
- " WHERE tagid=%d AND tagtype>0 AND rid=mlink.mid),'trunk') as branch"
270
+ " WHERE tagid=%d AND tagtype>0 AND "
271
+ " rid=mlink.mid),'trunk') as branch"
277272
" FROM mlink, filename, event, blob a, blob b"
278273
" WHERE filename.fnid=mlink.fnid"
279274
" AND event.objid=mlink.mid"
280275
" AND a.rid=mlink.fid"
281276
" AND b.rid=mlink.mid"
@@ -283,35 +278,11 @@
283278
" ORDER BY filename.name, event.mtime",
284279
TAG_BRANCH, rid
285280
);
286281
checkin_arr = cson_new_array();
287282
cson_object_set(pay, "checkins", cson_array_value(checkin_arr));
288
-#if 0
289
- /* Damn: json_tags_for_checkin_rid() only works for commits.
290
-
291
- FIXME: add json_tags_for_file_rid(), analog to
292
- json_tags_for_checkin_rid(), and then implement this loop to add the
293
- tags to each object.
294
- */
295
-
296
- while( SQLITE_ROW == db_step(&q) ){
297
- checkinV = cson_sqlite3_row_to_object( q.pStmt );
298
- if(!checkinV){
299
- continue;
300
- }
301
- if(!tagKey) {
302
- tagKey = cson_new_string("tags",4);
303
- json_gc_add("artifact/file/tags", cson_string_value(tagKey))
304
- /*avoids a potential lifetime issue*/;
305
- }
306
- checkin = cson_value_get_object(checkinV);
307
- cson_object_set_s(checkin, tagKey, json_tags_for_checkin_rid(rid,0));
308
- cson_array_append( checkin_arr, checkinV );
309
- }
310
-#else
311283
json_stmt_to_array_of_obj( &q, checkin_arr );
312
-#endif
313284
db_finalize(&q);
314285
return cson_object_value(pay);
315286
}
316287
317288
/*
318289
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -234,16 +234,10 @@
234 cson_object * pay = NULL;
235 const char *zMime;
236 Blob content = empty_blob;
237 Stmt q = empty_Stmt;
238 cson_array * checkin_arr = NULL;
239 #if 0
240 /*see next #if block below*/
241 cson_string * tagKey = NULL;
242 cson_value * checkinV = NULL;
243 cson_object * checkin = NULL;
244 #endif
245
246 if( ! g.perm.Read ){
247 json_set_err(FSL_JSON_E_DENIED,
248 "Requires 'o' privileges.");
249 return NULL;
@@ -269,13 +263,14 @@
269 db_prepare(&q,
270 "SELECT filename.name AS name, "
271 " cast(strftime('%%s',event.mtime) as int) AS mtime,"
272 " coalesce(event.ecomment,event.comment) as comment,"
273 " coalesce(event.euser,event.user) as user,"
274 " b.uuid as uuid, mlink.mperm as mperm,"/* WTF is mperm?*/
275 " coalesce((SELECT value FROM tagxref"
276 " WHERE tagid=%d AND tagtype>0 AND rid=mlink.mid),'trunk') as branch"
 
277 " FROM mlink, filename, event, blob a, blob b"
278 " WHERE filename.fnid=mlink.fnid"
279 " AND event.objid=mlink.mid"
280 " AND a.rid=mlink.fid"
281 " AND b.rid=mlink.mid"
@@ -283,35 +278,11 @@
283 " ORDER BY filename.name, event.mtime",
284 TAG_BRANCH, rid
285 );
286 checkin_arr = cson_new_array();
287 cson_object_set(pay, "checkins", cson_array_value(checkin_arr));
288 #if 0
289 /* Damn: json_tags_for_checkin_rid() only works for commits.
290
291 FIXME: add json_tags_for_file_rid(), analog to
292 json_tags_for_checkin_rid(), and then implement this loop to add the
293 tags to each object.
294 */
295
296 while( SQLITE_ROW == db_step(&q) ){
297 checkinV = cson_sqlite3_row_to_object( q.pStmt );
298 if(!checkinV){
299 continue;
300 }
301 if(!tagKey) {
302 tagKey = cson_new_string("tags",4);
303 json_gc_add("artifact/file/tags", cson_string_value(tagKey))
304 /*avoids a potential lifetime issue*/;
305 }
306 checkin = cson_value_get_object(checkinV);
307 cson_object_set_s(checkin, tagKey, json_tags_for_checkin_rid(rid,0));
308 cson_array_append( checkin_arr, checkinV );
309 }
310 #else
311 json_stmt_to_array_of_obj( &q, checkin_arr );
312 #endif
313 db_finalize(&q);
314 return cson_object_value(pay);
315 }
316
317 /*
318
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -234,16 +234,10 @@
234 cson_object * pay = NULL;
235 const char *zMime;
236 Blob content = empty_blob;
237 Stmt q = empty_Stmt;
238 cson_array * checkin_arr = NULL;
 
 
 
 
 
 
239
240 if( ! g.perm.Read ){
241 json_set_err(FSL_JSON_E_DENIED,
242 "Requires 'o' privileges.");
243 return NULL;
@@ -269,13 +263,14 @@
263 db_prepare(&q,
264 "SELECT filename.name AS name, "
265 " cast(strftime('%%s',event.mtime) as int) AS mtime,"
266 " coalesce(event.ecomment,event.comment) as comment,"
267 " coalesce(event.euser,event.user) as user,"
268 " b.uuid as uuid, mlink.mperm as mperm,"
269 " coalesce((SELECT value FROM tagxref"
270 " WHERE tagid=%d AND tagtype>0 AND "
271 " rid=mlink.mid),'trunk') as branch"
272 " FROM mlink, filename, event, blob a, blob b"
273 " WHERE filename.fnid=mlink.fnid"
274 " AND event.objid=mlink.mid"
275 " AND a.rid=mlink.fid"
276 " AND b.rid=mlink.mid"
@@ -283,35 +278,11 @@
278 " ORDER BY filename.name, event.mtime",
279 TAG_BRANCH, rid
280 );
281 checkin_arr = cson_new_array();
282 cson_object_set(pay, "checkins", cson_array_value(checkin_arr));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283 json_stmt_to_array_of_obj( &q, checkin_arr );
 
284 db_finalize(&q);
285 return cson_object_value(pay);
286 }
287
288 /*
289
--- src/json_detail.h
+++ src/json_detail.h
@@ -155,10 +155,14 @@
155155
fossil_json_f func;
156156
/*
157157
** Which mode(s) of execution does func() support:
158158
**
159159
** <0 = CLI only, >0 = HTTP only, 0==both
160
+ **
161
+ ** Now that we can simulate POST in CLI mode, the distinction
162
+ ** between them has disappeared in most (or all) cases, so 0 is the
163
+ ** the standard value.
160164
*/
161165
char runMode;
162166
} JsonPageDef;
163167
164168
/*
165169
--- src/json_detail.h
+++ src/json_detail.h
@@ -155,10 +155,14 @@
155 fossil_json_f func;
156 /*
157 ** Which mode(s) of execution does func() support:
158 **
159 ** <0 = CLI only, >0 = HTTP only, 0==both
 
 
 
 
160 */
161 char runMode;
162 } JsonPageDef;
163
164 /*
165
--- src/json_detail.h
+++ src/json_detail.h
@@ -155,10 +155,14 @@
155 fossil_json_f func;
156 /*
157 ** Which mode(s) of execution does func() support:
158 **
159 ** <0 = CLI only, >0 = HTTP only, 0==both
160 **
161 ** Now that we can simulate POST in CLI mode, the distinction
162 ** between them has disappeared in most (or all) cases, so 0 is the
163 ** the standard value.
164 */
165 char runMode;
166 } JsonPageDef;
167
168 /*
169
--- src/json_login.c
+++ src/json_login.c
@@ -57,16 +57,14 @@
5757
char const * name = cson_value_get_cstr(json_payload_property("name"));
5858
char const * pw = NULL;
5959
char const * anonSeed = NULL;
6060
cson_value * payload = NULL;
6161
int uid = 0;
62
- /* reminder to self:
63
- Fossil internally (for the sake of /wiki) interprets
64
- paths in the form /foo/bar/baz such that
65
- P("name") == "bar/baz". This collides with our
66
- name/password checking, and thus we check for the
67
- password first.
62
+ /* reminder to self: Fossil internally (for the sake of /wiki)
63
+ interprets paths in the form /foo/bar/baz such that P("name") ==
64
+ "bar/baz". This collides with our name/password checking, and
65
+ thus we do some rather elaborate name=... checking.
6866
*/
6967
pw = cson_value_get_cstr(json_payload_property("password"));
7068
if( !pw ){
7169
pw = PD("p",NULL);
7270
if( !pw ){
7371
--- src/json_login.c
+++ src/json_login.c
@@ -57,16 +57,14 @@
57 char const * name = cson_value_get_cstr(json_payload_property("name"));
58 char const * pw = NULL;
59 char const * anonSeed = NULL;
60 cson_value * payload = NULL;
61 int uid = 0;
62 /* reminder to self:
63 Fossil internally (for the sake of /wiki) interprets
64 paths in the form /foo/bar/baz such that
65 P("name") == "bar/baz". This collides with our
66 name/password checking, and thus we check for the
67 password first.
68 */
69 pw = cson_value_get_cstr(json_payload_property("password"));
70 if( !pw ){
71 pw = PD("p",NULL);
72 if( !pw ){
73
--- src/json_login.c
+++ src/json_login.c
@@ -57,16 +57,14 @@
57 char const * name = cson_value_get_cstr(json_payload_property("name"));
58 char const * pw = NULL;
59 char const * anonSeed = NULL;
60 cson_value * payload = NULL;
61 int uid = 0;
62 /* reminder to self: Fossil internally (for the sake of /wiki)
63 interprets paths in the form /foo/bar/baz such that P("name") ==
64 "bar/baz". This collides with our name/password checking, and
65 thus we do some rather elaborate name=... checking.
 
 
66 */
67 pw = cson_value_get_cstr(json_payload_property("password"));
68 if( !pw ){
69 pw = PD("p",NULL);
70 if( !pw ){
71

Keyboard Shortcuts

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