Fossil SCM
Add a "Synchronize" button to the Admin->Transfers page (or "Pull" if the "dont-push" option is set). Remark: I'm not sure if determining the user with user_select() is correct here, that's the tricky point to get right. In case of "fossil ui" it works fine, but could be improved for usefulness in other situations.
Commit
7c24de9cf192df3d22130e121d67717bc2cfb839
Parent
837c85bae5fb614…
2 files changed
+24
+24
+24
| --- src/xfersetup.c | ||
| +++ src/xfersetup.c | ||
| @@ -31,10 +31,34 @@ | ||
| 31 | 31 | if( !g.perm.Setup ){ |
| 32 | 32 | login_needed(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | style_header("Transfer Setup"); |
| 36 | + url_parse(0, 0); | |
| 37 | + if (g.urlProtocol){ | |
| 38 | + const char *zSync; | |
| 39 | + | |
| 40 | + if( db_get_boolean("dont-push", 0) ){ | |
| 41 | + zSync = "Pull"; | |
| 42 | + }else{ | |
| 43 | + zSync = "Synchronize"; | |
| 44 | + } | |
| 45 | + if( P("sync") ){ | |
| 46 | + user_select(); | |
| 47 | + url_enable_proxy(0); | |
| 48 | + client_sync(SYNC_PUSH|SYNC_PULL, 0, 0); | |
| 49 | + } | |
| 50 | + @ | |
| 51 | + @ <blockquote> | |
| 52 | + @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> | |
| 53 | + login_insert_csrf_secret(); | |
| 54 | + @ <input type="submit" name="sync" value="%h(zSync)" /> | |
| 55 | + @ </div></form> | |
| 56 | + @ </blockquote> | |
| 57 | + @ | |
| 58 | + } | |
| 59 | + | |
| 36 | 60 | @ <table border="0" cellspacing="20"> |
| 37 | 61 | setup_menu_entry("Common", "xfersetup_com", |
| 38 | 62 | "Common TH1 code run before all transfer request processing."); |
| 39 | 63 | setup_menu_entry("Push", "xfersetup_push", |
| 40 | 64 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 41 | 65 |
| --- src/xfersetup.c | |
| +++ src/xfersetup.c | |
| @@ -31,10 +31,34 @@ | |
| 31 | if( !g.perm.Setup ){ |
| 32 | login_needed(); |
| 33 | } |
| 34 | |
| 35 | style_header("Transfer Setup"); |
| 36 | @ <table border="0" cellspacing="20"> |
| 37 | setup_menu_entry("Common", "xfersetup_com", |
| 38 | "Common TH1 code run before all transfer request processing."); |
| 39 | setup_menu_entry("Push", "xfersetup_push", |
| 40 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 41 |
| --- src/xfersetup.c | |
| +++ src/xfersetup.c | |
| @@ -31,10 +31,34 @@ | |
| 31 | if( !g.perm.Setup ){ |
| 32 | login_needed(); |
| 33 | } |
| 34 | |
| 35 | style_header("Transfer Setup"); |
| 36 | url_parse(0, 0); |
| 37 | if (g.urlProtocol){ |
| 38 | const char *zSync; |
| 39 | |
| 40 | if( db_get_boolean("dont-push", 0) ){ |
| 41 | zSync = "Pull"; |
| 42 | }else{ |
| 43 | zSync = "Synchronize"; |
| 44 | } |
| 45 | if( P("sync") ){ |
| 46 | user_select(); |
| 47 | url_enable_proxy(0); |
| 48 | client_sync(SYNC_PUSH|SYNC_PULL, 0, 0); |
| 49 | } |
| 50 | @ |
| 51 | @ <blockquote> |
| 52 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 53 | login_insert_csrf_secret(); |
| 54 | @ <input type="submit" name="sync" value="%h(zSync)" /> |
| 55 | @ </div></form> |
| 56 | @ </blockquote> |
| 57 | @ |
| 58 | } |
| 59 | |
| 60 | @ <table border="0" cellspacing="20"> |
| 61 | setup_menu_entry("Common", "xfersetup_com", |
| 62 | "Common TH1 code run before all transfer request processing."); |
| 63 | setup_menu_entry("Push", "xfersetup_push", |
| 64 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 65 |
+24
| --- src/xfersetup.c | ||
| +++ src/xfersetup.c | ||
| @@ -31,10 +31,34 @@ | ||
| 31 | 31 | if( !g.perm.Setup ){ |
| 32 | 32 | login_needed(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | style_header("Transfer Setup"); |
| 36 | + url_parse(0, 0); | |
| 37 | + if (g.urlProtocol){ | |
| 38 | + const char *zSync; | |
| 39 | + | |
| 40 | + if( db_get_boolean("dont-push", 0) ){ | |
| 41 | + zSync = "Pull"; | |
| 42 | + }else{ | |
| 43 | + zSync = "Synchronize"; | |
| 44 | + } | |
| 45 | + if( P("sync") ){ | |
| 46 | + user_select(); | |
| 47 | + url_enable_proxy(0); | |
| 48 | + client_sync(SYNC_PUSH|SYNC_PULL, 0, 0); | |
| 49 | + } | |
| 50 | + @ | |
| 51 | + @ <blockquote> | |
| 52 | + @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> | |
| 53 | + login_insert_csrf_secret(); | |
| 54 | + @ <input type="submit" name="sync" value="%h(zSync)" /> | |
| 55 | + @ </div></form> | |
| 56 | + @ </blockquote> | |
| 57 | + @ | |
| 58 | + } | |
| 59 | + | |
| 36 | 60 | @ <table border="0" cellspacing="20"> |
| 37 | 61 | setup_menu_entry("Common", "xfersetup_com", |
| 38 | 62 | "Common TH1 code run before all transfer request processing."); |
| 39 | 63 | setup_menu_entry("Push", "xfersetup_push", |
| 40 | 64 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 41 | 65 |
| --- src/xfersetup.c | |
| +++ src/xfersetup.c | |
| @@ -31,10 +31,34 @@ | |
| 31 | if( !g.perm.Setup ){ |
| 32 | login_needed(); |
| 33 | } |
| 34 | |
| 35 | style_header("Transfer Setup"); |
| 36 | @ <table border="0" cellspacing="20"> |
| 37 | setup_menu_entry("Common", "xfersetup_com", |
| 38 | "Common TH1 code run before all transfer request processing."); |
| 39 | setup_menu_entry("Push", "xfersetup_push", |
| 40 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 41 |
| --- src/xfersetup.c | |
| +++ src/xfersetup.c | |
| @@ -31,10 +31,34 @@ | |
| 31 | if( !g.perm.Setup ){ |
| 32 | login_needed(); |
| 33 | } |
| 34 | |
| 35 | style_header("Transfer Setup"); |
| 36 | url_parse(0, 0); |
| 37 | if (g.urlProtocol){ |
| 38 | const char *zSync; |
| 39 | |
| 40 | if( db_get_boolean("dont-push", 0) ){ |
| 41 | zSync = "Pull"; |
| 42 | }else{ |
| 43 | zSync = "Synchronize"; |
| 44 | } |
| 45 | if( P("sync") ){ |
| 46 | user_select(); |
| 47 | url_enable_proxy(0); |
| 48 | client_sync(SYNC_PUSH|SYNC_PULL, 0, 0); |
| 49 | } |
| 50 | @ |
| 51 | @ <blockquote> |
| 52 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 53 | login_insert_csrf_secret(); |
| 54 | @ <input type="submit" name="sync" value="%h(zSync)" /> |
| 55 | @ </div></form> |
| 56 | @ </blockquote> |
| 57 | @ |
| 58 | } |
| 59 | |
| 60 | @ <table border="0" cellspacing="20"> |
| 61 | setup_menu_entry("Common", "xfersetup_com", |
| 62 | "Common TH1 code run before all transfer request processing."); |
| 63 | setup_menu_entry("Push", "xfersetup_push", |
| 64 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 65 |