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.

jan.nijtmans 2013-10-15 06:53 UTC tkt-change-hook
Commit 7c24de9cf192df3d22130e121d67717bc2cfb839
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -31,10 +31,34 @@
3131
if( !g.perm.Setup ){
3232
login_needed();
3333
}
3434
3535
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
+
3660
@ <table border="0" cellspacing="20">
3761
setup_menu_entry("Common", "xfersetup_com",
3862
"Common TH1 code run before all transfer request processing.");
3963
setup_menu_entry("Push", "xfersetup_push",
4064
"Specific TH1 code to run after \"push\" transfer requests.");
4165
--- 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
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -31,10 +31,34 @@
3131
if( !g.perm.Setup ){
3232
login_needed();
3333
}
3434
3535
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
+
3660
@ <table border="0" cellspacing="20">
3761
setup_menu_entry("Common", "xfersetup_com",
3862
"Common TH1 code run before all transfer request processing.");
3963
setup_menu_entry("Push", "xfersetup_push",
4064
"Specific TH1 code to run after \"push\" transfer requests.");
4165
--- 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

Keyboard Shortcuts

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