Fossil SCM
Added downloadPath property to files in timeline view, leading to /raw/FILENAME?name=uuid.
Commit
ea5e58155d745a80f39495a8e1334559330cb4bc
Parent
3025ecb2ae35bf4…
1 file changed
+8
-1
+8
-1
| --- src/json_timeline.c | ||
| +++ src/json_timeline.c | ||
| @@ -320,14 +320,16 @@ | ||
| 320 | 320 | while( (SQLITE_ROW == db_step(&q)) ){ |
| 321 | 321 | cson_value * rowV = cson_value_new_object(); |
| 322 | 322 | cson_object * row = cson_value_get_object(rowV); |
| 323 | 323 | int const isNew = db_column_int(&q,0); |
| 324 | 324 | int const isDel = db_column_int(&q,1); |
| 325 | + char * zDownload = NULL; | |
| 325 | 326 | if(!rowsV){ |
| 326 | 327 | rowsV = cson_value_new_array(); |
| 327 | 328 | rows = cson_value_get_array(rowsV); |
| 328 | 329 | } |
| 330 | + cson_array_append( rows, rowV ); | |
| 329 | 331 | cson_object_set(row, "name", json_new_string(db_column_text(&q,2))); |
| 330 | 332 | cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3))); |
| 331 | 333 | if(!isNew){ |
| 332 | 334 | cson_object_set(row, "prevUuid", json_new_string(db_column_text(&q,4))); |
| 333 | 335 | } |
| @@ -335,11 +337,16 @@ | ||
| 335 | 337 | json_new_string(isNew |
| 336 | 338 | ? "added" |
| 337 | 339 | : (isDel |
| 338 | 340 | ? "removed" |
| 339 | 341 | : "modified"))); |
| 340 | - cson_array_append( rows, rowV ); | |
| 342 | + zDownload = mprintf("/raw/%s?name=%s", | |
| 343 | + /* reminder: g.zBaseURL is of course not set for CLI mode. */ | |
| 344 | + db_column_text(&q,2), | |
| 345 | + db_column_text(&q,3)); | |
| 346 | + cson_object_set(row, "downloadPath", json_new_string(zDownload)); | |
| 347 | + free(zDownload); | |
| 341 | 348 | } |
| 342 | 349 | db_finalize(&q); |
| 343 | 350 | return rowsV; |
| 344 | 351 | } |
| 345 | 352 | |
| 346 | 353 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -320,14 +320,16 @@ | |
| 320 | while( (SQLITE_ROW == db_step(&q)) ){ |
| 321 | cson_value * rowV = cson_value_new_object(); |
| 322 | cson_object * row = cson_value_get_object(rowV); |
| 323 | int const isNew = db_column_int(&q,0); |
| 324 | int const isDel = db_column_int(&q,1); |
| 325 | if(!rowsV){ |
| 326 | rowsV = cson_value_new_array(); |
| 327 | rows = cson_value_get_array(rowsV); |
| 328 | } |
| 329 | cson_object_set(row, "name", json_new_string(db_column_text(&q,2))); |
| 330 | cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3))); |
| 331 | if(!isNew){ |
| 332 | cson_object_set(row, "prevUuid", json_new_string(db_column_text(&q,4))); |
| 333 | } |
| @@ -335,11 +337,16 @@ | |
| 335 | json_new_string(isNew |
| 336 | ? "added" |
| 337 | : (isDel |
| 338 | ? "removed" |
| 339 | : "modified"))); |
| 340 | cson_array_append( rows, rowV ); |
| 341 | } |
| 342 | db_finalize(&q); |
| 343 | return rowsV; |
| 344 | } |
| 345 | |
| 346 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -320,14 +320,16 @@ | |
| 320 | while( (SQLITE_ROW == db_step(&q)) ){ |
| 321 | cson_value * rowV = cson_value_new_object(); |
| 322 | cson_object * row = cson_value_get_object(rowV); |
| 323 | int const isNew = db_column_int(&q,0); |
| 324 | int const isDel = db_column_int(&q,1); |
| 325 | char * zDownload = NULL; |
| 326 | if(!rowsV){ |
| 327 | rowsV = cson_value_new_array(); |
| 328 | rows = cson_value_get_array(rowsV); |
| 329 | } |
| 330 | cson_array_append( rows, rowV ); |
| 331 | cson_object_set(row, "name", json_new_string(db_column_text(&q,2))); |
| 332 | cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3))); |
| 333 | if(!isNew){ |
| 334 | cson_object_set(row, "prevUuid", json_new_string(db_column_text(&q,4))); |
| 335 | } |
| @@ -335,11 +337,16 @@ | |
| 337 | json_new_string(isNew |
| 338 | ? "added" |
| 339 | : (isDel |
| 340 | ? "removed" |
| 341 | : "modified"))); |
| 342 | zDownload = mprintf("/raw/%s?name=%s", |
| 343 | /* reminder: g.zBaseURL is of course not set for CLI mode. */ |
| 344 | db_column_text(&q,2), |
| 345 | db_column_text(&q,3)); |
| 346 | cson_object_set(row, "downloadPath", json_new_string(zDownload)); |
| 347 | free(zDownload); |
| 348 | } |
| 349 | db_finalize(&q); |
| 350 | return rowsV; |
| 351 | } |
| 352 | |
| 353 |