Fossil SCM
Use the "plunk" sound for audiable alert in chat. Back out the "ping" processing logic.
Commit
f2fcdbc505c3836af9d1295426d5d9027f6ce369fdc3a7fa6f0c25feedb528ea
Parent
6643d4a0c1aabb8…
10 files changed
+1
-1
+36
-70
+10
-16
+1
-1
+4
-51
+1
-1
+53
+1
-1
+2
-2
+1
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -2137,11 +2137,11 @@ | ||
| 2137 | 2137 | if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ |
| 2138 | 2138 | fossil_warning("cannot start browser\n"); |
| 2139 | 2139 | } |
| 2140 | 2140 | }else |
| 2141 | 2141 | #endif |
| 2142 | - if( system(zBrowser)<0 ){ | |
| 2142 | + if( fossil_system(zBrowser)<0 ){ | |
| 2143 | 2143 | fossil_warning("cannot start browser: %s\n", zBrowser); |
| 2144 | 2144 | } |
| 2145 | 2145 | } |
| 2146 | 2146 | while( 1 ){ |
| 2147 | 2147 | #if FOSSIL_MAX_CONNECTIONS>0 |
| 2148 | 2148 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2137,11 +2137,11 @@ | |
| 2137 | if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ |
| 2138 | fossil_warning("cannot start browser\n"); |
| 2139 | } |
| 2140 | }else |
| 2141 | #endif |
| 2142 | if( system(zBrowser)<0 ){ |
| 2143 | fossil_warning("cannot start browser: %s\n", zBrowser); |
| 2144 | } |
| 2145 | } |
| 2146 | while( 1 ){ |
| 2147 | #if FOSSIL_MAX_CONNECTIONS>0 |
| 2148 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2137,11 +2137,11 @@ | |
| 2137 | if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ |
| 2138 | fossil_warning("cannot start browser\n"); |
| 2139 | } |
| 2140 | }else |
| 2141 | #endif |
| 2142 | if( fossil_system(zBrowser)<0 ){ |
| 2143 | fossil_warning("cannot start browser: %s\n", zBrowser); |
| 2144 | } |
| 2145 | } |
| 2146 | while( 1 ){ |
| 2147 | #if FOSSIL_MAX_CONNECTIONS>0 |
| 2148 |
+36
-70
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -101,19 +101,15 @@ | ||
| 101 | 101 | ** |
| 102 | 102 | ** Other /chat-OP pages are used by XHR requests from this page to |
| 103 | 103 | ** send new chat message, delete older messages, or poll for changes. |
| 104 | 104 | */ |
| 105 | 105 | void chat_webpage(void){ |
| 106 | - int iPingTcp; | |
| 107 | 106 | login_check_credentials(); |
| 108 | 107 | if( !g.perm.Chat ){ |
| 109 | 108 | login_needed(g.anon.Chat); |
| 110 | 109 | return; |
| 111 | 110 | } |
| 112 | - iPingTcp = atoi(PD("ping","0")); | |
| 113 | - if( iPingTcp<1000 || iPingTcp>65535 ) iPingTcp = 0; | |
| 114 | - if( iPingTcp ) style_disable_csp(); | |
| 115 | 111 | style_set_current_feature("chat"); |
| 116 | 112 | style_header("Chat"); |
| 117 | 113 | @ <form accept-encoding="utf-8" id="chat-form" autocomplete="off"> |
| 118 | 114 | @ <div id='chat-input-area'> |
| 119 | 115 | @ <div id='chat-input-line'> |
| @@ -153,11 +149,11 @@ | ||
| 153 | 149 | initialized before the chat init code runs. */ |
| 154 | 150 | @ window.addEventListener('load', function(){ |
| 155 | 151 | @ document.body.classList.add('chat') |
| 156 | 152 | @ /*^^^for skins which add their own BODY tag */; |
| 157 | 153 | @ window.fossil.config.chat = { |
| 158 | - @ pingTcp: %d(iPingTcp), | |
| 154 | + @ fromcli: %h(PB("cli")?"true":"false"), | |
| 159 | 155 | @ initSize: %d(db_get_int("chat-initial-history",50)), |
| 160 | 156 | @ imagesInline: !!%d(db_get_boolean("chat-inline-images",1)) |
| 161 | 157 | @ }; |
| 162 | 158 | cgi_append_content(builtin_text("chat.js"),-1); |
| 163 | 159 | @ }, false); |
| @@ -663,87 +659,57 @@ | ||
| 663 | 659 | mdel, g.zLogin, mdel |
| 664 | 660 | ); |
| 665 | 661 | } |
| 666 | 662 | |
| 667 | 663 | /* |
| 668 | -** WEBPAGE: chat-ping | |
| 669 | -** | |
| 670 | -** HTTP requests coming to this page from a loopback IP address cause | |
| 671 | -** a single \007 (bel) character to be written on the controlling TTY. | |
| 672 | -** This is used to implement an audiable alert by local web clients. | |
| 673 | -*/ | |
| 674 | -void chat_ping_webpage(void){ | |
| 675 | - const char *zIpAddr = PD("REMOTE_ADDR","nil"); | |
| 676 | - if( cgi_is_loopback(zIpAddr) ){ | |
| 677 | - cgi_append_header("Access-Control-Allow-Origin: *\r\n"); | |
| 678 | - fputc(7, stderr); | |
| 679 | - } | |
| 680 | -} | |
| 681 | - | |
| 682 | -/* | |
| 683 | -** WEBPAGE: chat-audio-received | |
| 684 | -** | |
| 685 | -** Responds with an audio stream suitable for use as a /chat | |
| 686 | -** new-message-arrived notification. | |
| 664 | +** WEBPAGE: chat-alert | |
| 665 | +** | |
| 666 | +** Return the sound file that should be played when a new chat message | |
| 667 | +** arrives. | |
| 687 | 668 | */ |
| 688 | 669 | void chat_audio_alert(void){ |
| 689 | 670 | Blob audio = empty_blob; |
| 690 | 671 | int n = 0; |
| 691 | 672 | const char * zAudio = |
| 692 | - (const char *)builtin_file("sounds/chat-received.wav", &n); | |
| 673 | + (const char *)builtin_file("sounds/plunk.wav", &n); | |
| 693 | 674 | blob_init(&audio, zAudio, n); |
| 694 | 675 | cgi_set_content_type("audio/wav"); |
| 695 | 676 | cgi_set_content(&audio); |
| 696 | 677 | } |
| 697 | 678 | |
| 698 | 679 | /* |
| 699 | 680 | ** COMMAND: chat |
| 700 | 681 | ** |
| 701 | -** Usage: %fossil chat ?URL? | |
| 682 | +** Usage: %fossil chat | |
| 702 | 683 | ** |
| 703 | -** Bring up a window to the chatroom feature of the Fossil repository | |
| 704 | -** at URL. Or if URL is not specified, use the default remote repository. | |
| 705 | -** Event notifications on this session cause the U+0007 character to | |
| 706 | -** be sent to the TTY on which the "fossil chat" command is run, thus | |
| 707 | -** causing an auditory notification. | |
| 684 | +** Bring up a web-browser window to the chatroom of the default | |
| 685 | +** remote Fossil repository. | |
| 708 | 686 | */ |
| 709 | 687 | void chat_command(void){ |
| 710 | - const char *zUrl = 0; | |
| 711 | - size_t i; | |
| 712 | - char *azArgv[5]; | |
| 713 | - db_find_and_open_repository(0,0); | |
| 714 | - if( g.argc==3 ){ | |
| 715 | - zUrl = g.argv[2]; | |
| 716 | - }else if( g.argc!=2 ){ | |
| 717 | - usage("?URL?"); | |
| 718 | - }else{ | |
| 719 | - zUrl = db_get("last-sync-url",0); | |
| 720 | - if( zUrl==0 ){ | |
| 721 | - fossil_fatal("no \"remote\" repository defined. Use a URL argument"); | |
| 722 | - } | |
| 723 | - url_parse(zUrl, 0); | |
| 724 | - if( g.url.port==g.url.dfltPort ){ | |
| 725 | - zUrl = mprintf( | |
| 726 | - "%s://%T%T", | |
| 727 | - g.url.protocol, g.url.name, g.url.path | |
| 728 | - ); | |
| 729 | - }else{ | |
| 730 | - zUrl = mprintf( | |
| 731 | - "%s://%T:%d%T", | |
| 732 | - g.url.protocol, g.url.name, g.url.port, g.url.path | |
| 733 | - ); | |
| 734 | - } | |
| 735 | - } | |
| 736 | - if( strncmp(zUrl,"http://",7)!=0 && strncmp("https://",zUrl,8)!=0 ){ | |
| 737 | - fossil_fatal("Not a valid URL: %s", zUrl); | |
| 738 | - } | |
| 739 | - azArgv[0] = g.argv[0]; | |
| 740 | - azArgv[1] = "ui"; | |
| 741 | - azArgv[2] = "--internal-chat-url"; | |
| 742 | - i = strlen(zUrl); | |
| 743 | - if( i && zUrl[i-1]=='/' ) i--; | |
| 744 | - azArgv[3] = mprintf("%.*s/chat?ping=%%d", i, zUrl); | |
| 745 | - azArgv[4] = 0; | |
| 746 | - g.argv = azArgv; | |
| 747 | - g.argc = 4; | |
| 748 | - cmd_webserver(); | |
| 688 | + const char *zUrl; | |
| 689 | + const char *zBrowser; | |
| 690 | + char *zCmd; | |
| 691 | + db_find_and_open_repository(0,0); | |
| 692 | + if( g.argc!=2 ){ | |
| 693 | + usage(""); | |
| 694 | + } | |
| 695 | + zUrl = db_get("last-sync-url",0); | |
| 696 | + if( zUrl==0 ){ | |
| 697 | + fossil_fatal("no \"remote\" repository defined"); | |
| 698 | + } | |
| 699 | + url_parse(zUrl, 0); | |
| 700 | + if( g.url.port==g.url.dfltPort ){ | |
| 701 | + zUrl = mprintf( | |
| 702 | + "%s://%T%T", | |
| 703 | + g.url.protocol, g.url.name, g.url.path | |
| 704 | + ); | |
| 705 | + }else{ | |
| 706 | + zUrl = mprintf( | |
| 707 | + "%s://%T:%d%T", | |
| 708 | + g.url.protocol, g.url.name, g.url.port, g.url.path | |
| 709 | + ); | |
| 710 | + } | |
| 711 | + zBrowser = fossil_web_browser(); | |
| 712 | + if( zBrowser==0 ) return; | |
| 713 | + zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl); | |
| 714 | + fossil_system(zCmd); | |
| 749 | 715 | } |
| 750 | 716 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -101,19 +101,15 @@ | |
| 101 | ** |
| 102 | ** Other /chat-OP pages are used by XHR requests from this page to |
| 103 | ** send new chat message, delete older messages, or poll for changes. |
| 104 | */ |
| 105 | void chat_webpage(void){ |
| 106 | int iPingTcp; |
| 107 | login_check_credentials(); |
| 108 | if( !g.perm.Chat ){ |
| 109 | login_needed(g.anon.Chat); |
| 110 | return; |
| 111 | } |
| 112 | iPingTcp = atoi(PD("ping","0")); |
| 113 | if( iPingTcp<1000 || iPingTcp>65535 ) iPingTcp = 0; |
| 114 | if( iPingTcp ) style_disable_csp(); |
| 115 | style_set_current_feature("chat"); |
| 116 | style_header("Chat"); |
| 117 | @ <form accept-encoding="utf-8" id="chat-form" autocomplete="off"> |
| 118 | @ <div id='chat-input-area'> |
| 119 | @ <div id='chat-input-line'> |
| @@ -153,11 +149,11 @@ | |
| 153 | initialized before the chat init code runs. */ |
| 154 | @ window.addEventListener('load', function(){ |
| 155 | @ document.body.classList.add('chat') |
| 156 | @ /*^^^for skins which add their own BODY tag */; |
| 157 | @ window.fossil.config.chat = { |
| 158 | @ pingTcp: %d(iPingTcp), |
| 159 | @ initSize: %d(db_get_int("chat-initial-history",50)), |
| 160 | @ imagesInline: !!%d(db_get_boolean("chat-inline-images",1)) |
| 161 | @ }; |
| 162 | cgi_append_content(builtin_text("chat.js"),-1); |
| 163 | @ }, false); |
| @@ -663,87 +659,57 @@ | |
| 663 | mdel, g.zLogin, mdel |
| 664 | ); |
| 665 | } |
| 666 | |
| 667 | /* |
| 668 | ** WEBPAGE: chat-ping |
| 669 | ** |
| 670 | ** HTTP requests coming to this page from a loopback IP address cause |
| 671 | ** a single \007 (bel) character to be written on the controlling TTY. |
| 672 | ** This is used to implement an audiable alert by local web clients. |
| 673 | */ |
| 674 | void chat_ping_webpage(void){ |
| 675 | const char *zIpAddr = PD("REMOTE_ADDR","nil"); |
| 676 | if( cgi_is_loopback(zIpAddr) ){ |
| 677 | cgi_append_header("Access-Control-Allow-Origin: *\r\n"); |
| 678 | fputc(7, stderr); |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | /* |
| 683 | ** WEBPAGE: chat-audio-received |
| 684 | ** |
| 685 | ** Responds with an audio stream suitable for use as a /chat |
| 686 | ** new-message-arrived notification. |
| 687 | */ |
| 688 | void chat_audio_alert(void){ |
| 689 | Blob audio = empty_blob; |
| 690 | int n = 0; |
| 691 | const char * zAudio = |
| 692 | (const char *)builtin_file("sounds/chat-received.wav", &n); |
| 693 | blob_init(&audio, zAudio, n); |
| 694 | cgi_set_content_type("audio/wav"); |
| 695 | cgi_set_content(&audio); |
| 696 | } |
| 697 | |
| 698 | /* |
| 699 | ** COMMAND: chat |
| 700 | ** |
| 701 | ** Usage: %fossil chat ?URL? |
| 702 | ** |
| 703 | ** Bring up a window to the chatroom feature of the Fossil repository |
| 704 | ** at URL. Or if URL is not specified, use the default remote repository. |
| 705 | ** Event notifications on this session cause the U+0007 character to |
| 706 | ** be sent to the TTY on which the "fossil chat" command is run, thus |
| 707 | ** causing an auditory notification. |
| 708 | */ |
| 709 | void chat_command(void){ |
| 710 | const char *zUrl = 0; |
| 711 | size_t i; |
| 712 | char *azArgv[5]; |
| 713 | db_find_and_open_repository(0,0); |
| 714 | if( g.argc==3 ){ |
| 715 | zUrl = g.argv[2]; |
| 716 | }else if( g.argc!=2 ){ |
| 717 | usage("?URL?"); |
| 718 | }else{ |
| 719 | zUrl = db_get("last-sync-url",0); |
| 720 | if( zUrl==0 ){ |
| 721 | fossil_fatal("no \"remote\" repository defined. Use a URL argument"); |
| 722 | } |
| 723 | url_parse(zUrl, 0); |
| 724 | if( g.url.port==g.url.dfltPort ){ |
| 725 | zUrl = mprintf( |
| 726 | "%s://%T%T", |
| 727 | g.url.protocol, g.url.name, g.url.path |
| 728 | ); |
| 729 | }else{ |
| 730 | zUrl = mprintf( |
| 731 | "%s://%T:%d%T", |
| 732 | g.url.protocol, g.url.name, g.url.port, g.url.path |
| 733 | ); |
| 734 | } |
| 735 | } |
| 736 | if( strncmp(zUrl,"http://",7)!=0 && strncmp("https://",zUrl,8)!=0 ){ |
| 737 | fossil_fatal("Not a valid URL: %s", zUrl); |
| 738 | } |
| 739 | azArgv[0] = g.argv[0]; |
| 740 | azArgv[1] = "ui"; |
| 741 | azArgv[2] = "--internal-chat-url"; |
| 742 | i = strlen(zUrl); |
| 743 | if( i && zUrl[i-1]=='/' ) i--; |
| 744 | azArgv[3] = mprintf("%.*s/chat?ping=%%d", i, zUrl); |
| 745 | azArgv[4] = 0; |
| 746 | g.argv = azArgv; |
| 747 | g.argc = 4; |
| 748 | cmd_webserver(); |
| 749 | } |
| 750 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -101,19 +101,15 @@ | |
| 101 | ** |
| 102 | ** Other /chat-OP pages are used by XHR requests from this page to |
| 103 | ** send new chat message, delete older messages, or poll for changes. |
| 104 | */ |
| 105 | void chat_webpage(void){ |
| 106 | login_check_credentials(); |
| 107 | if( !g.perm.Chat ){ |
| 108 | login_needed(g.anon.Chat); |
| 109 | return; |
| 110 | } |
| 111 | style_set_current_feature("chat"); |
| 112 | style_header("Chat"); |
| 113 | @ <form accept-encoding="utf-8" id="chat-form" autocomplete="off"> |
| 114 | @ <div id='chat-input-area'> |
| 115 | @ <div id='chat-input-line'> |
| @@ -153,11 +149,11 @@ | |
| 149 | initialized before the chat init code runs. */ |
| 150 | @ window.addEventListener('load', function(){ |
| 151 | @ document.body.classList.add('chat') |
| 152 | @ /*^^^for skins which add their own BODY tag */; |
| 153 | @ window.fossil.config.chat = { |
| 154 | @ fromcli: %h(PB("cli")?"true":"false"), |
| 155 | @ initSize: %d(db_get_int("chat-initial-history",50)), |
| 156 | @ imagesInline: !!%d(db_get_boolean("chat-inline-images",1)) |
| 157 | @ }; |
| 158 | cgi_append_content(builtin_text("chat.js"),-1); |
| 159 | @ }, false); |
| @@ -663,87 +659,57 @@ | |
| 659 | mdel, g.zLogin, mdel |
| 660 | ); |
| 661 | } |
| 662 | |
| 663 | /* |
| 664 | ** WEBPAGE: chat-alert |
| 665 | ** |
| 666 | ** Return the sound file that should be played when a new chat message |
| 667 | ** arrives. |
| 668 | */ |
| 669 | void chat_audio_alert(void){ |
| 670 | Blob audio = empty_blob; |
| 671 | int n = 0; |
| 672 | const char * zAudio = |
| 673 | (const char *)builtin_file("sounds/plunk.wav", &n); |
| 674 | blob_init(&audio, zAudio, n); |
| 675 | cgi_set_content_type("audio/wav"); |
| 676 | cgi_set_content(&audio); |
| 677 | } |
| 678 | |
| 679 | /* |
| 680 | ** COMMAND: chat |
| 681 | ** |
| 682 | ** Usage: %fossil chat |
| 683 | ** |
| 684 | ** Bring up a web-browser window to the chatroom of the default |
| 685 | ** remote Fossil repository. |
| 686 | */ |
| 687 | void chat_command(void){ |
| 688 | const char *zUrl; |
| 689 | const char *zBrowser; |
| 690 | char *zCmd; |
| 691 | db_find_and_open_repository(0,0); |
| 692 | if( g.argc!=2 ){ |
| 693 | usage(""); |
| 694 | } |
| 695 | zUrl = db_get("last-sync-url",0); |
| 696 | if( zUrl==0 ){ |
| 697 | fossil_fatal("no \"remote\" repository defined"); |
| 698 | } |
| 699 | url_parse(zUrl, 0); |
| 700 | if( g.url.port==g.url.dfltPort ){ |
| 701 | zUrl = mprintf( |
| 702 | "%s://%T%T", |
| 703 | g.url.protocol, g.url.name, g.url.path |
| 704 | ); |
| 705 | }else{ |
| 706 | zUrl = mprintf( |
| 707 | "%s://%T:%d%T", |
| 708 | g.url.protocol, g.url.name, g.url.port, g.url.path |
| 709 | ); |
| 710 | } |
| 711 | zBrowser = fossil_web_browser(); |
| 712 | if( zBrowser==0 ) return; |
| 713 | zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl); |
| 714 | fossil_system(zCmd); |
| 715 | } |
| 716 |
+10
-16
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -355,20 +355,20 @@ | ||
| 355 | 355 | defaults:{ |
| 356 | 356 | "images-inline": !!F.config.chat.imagesInline, |
| 357 | 357 | "edit-multiline": false, |
| 358 | 358 | "monospace-messages": false, |
| 359 | 359 | "chat-only-mode": false, |
| 360 | - "audio-notification": true, | |
| 360 | + "audible-alert": true, | |
| 361 | 361 | } |
| 362 | 362 | }, |
| 363 | - /** Plays a new-message notification sound IF the audio-notification | |
| 363 | + /** Plays a new-message notification sound IF the audible-alert | |
| 364 | 364 | setting is true, else this is a no-op. Returns this. |
| 365 | 365 | */ |
| 366 | 366 | playNewMessageSound: function f(){ |
| 367 | - if(this.settings.getBool('audio-notification',false)){ | |
| 367 | + if(this.settings.getBool('audible-alert',false)){ | |
| 368 | 368 | try{ |
| 369 | - if(!f.audio) f.audio = new Audio(F.rootPath+"chat-audio-received"); | |
| 369 | + if(!f.audio) f.audio = new Audio(F.rootPath+"chat-alert"); | |
| 370 | 370 | f.audio.currentTime = 0; |
| 371 | 371 | f.audio.play(); |
| 372 | 372 | }catch(e){ |
| 373 | 373 | console.error("Audio playblack failed.",e); |
| 374 | 374 | } |
| @@ -934,17 +934,17 @@ | ||
| 934 | 934 | const v = Chat.settings.getBool('images-inline',true); |
| 935 | 935 | Chat.settings.set('images-inline', !v); |
| 936 | 936 | F.toast.message("Image mode set to "+(v ? "hyperlink" : "inline")+"."); |
| 937 | 937 | } |
| 938 | 938 | },{ |
| 939 | - label: "Audio notifications", | |
| 940 | - boolValue: ()=>Chat.settings.getBool('audio-notification'), | |
| 939 | + label: "Audible alerts", | |
| 940 | + boolValue: ()=>Chat.settings.getBool('audible-alert'), | |
| 941 | 941 | callback: function(){ |
| 942 | - const v = Chat.settings.getBool('audio-notification'); | |
| 943 | - Chat.settings.set('audio-notification', !v); | |
| 942 | + const v = Chat.settings.getBool('audible-alert'); | |
| 943 | + Chat.settings.set('audible-alert', !v); | |
| 944 | 944 | if(!v){ |
| 945 | - setTimeout(()=>Chat.playNewMessageSound(), 500); | |
| 945 | + setTimeout(()=>Chat.playNewMessageSound(), 50); | |
| 946 | 946 | } |
| 947 | 947 | F.toast.message("Audio notifications "+(v ? "disabled" : "enabled")+"."); |
| 948 | 948 | } |
| 949 | 949 | }]; |
| 950 | 950 | |
| @@ -1057,13 +1057,10 @@ | ||
| 1057 | 1057 | Chat.changesSincePageHidden += jx.msgs.length; |
| 1058 | 1058 | if(jx.msgs.length){ |
| 1059 | 1059 | Chat.e.pageTitle.innerText = '[*] '+Chat.pageTitleOrig; |
| 1060 | 1060 | } |
| 1061 | 1061 | } |
| 1062 | - if(jx.msgs.length && F.config.chat.pingTcp){ | |
| 1063 | - fetch("http:/"+"/localhost:"+F.config.chat.pingTcp+"/chat-ping"); | |
| 1064 | - } | |
| 1065 | 1062 | }/*newcontent()*/; |
| 1066 | 1063 | Chat.newContent = newcontent; |
| 1067 | 1064 | |
| 1068 | 1065 | (function(){ |
| 1069 | 1066 | /** Add toolbar for loading older messages. We use a FIELDSET here |
| @@ -1169,14 +1166,11 @@ | ||
| 1169 | 1166 | Chat._gotServerError = poll.running = false; |
| 1170 | 1167 | poll(true); |
| 1171 | 1168 | if(!Chat._gotServerError){ |
| 1172 | 1169 | Chat.intervalTimer = setInterval(poll, 1000); |
| 1173 | 1170 | } |
| 1174 | - if(/\bping=\d+/.test(window.location.search)){ | |
| 1175 | - /* If we see the 'ping' parameter we're certain this was run via | |
| 1176 | - the 'fossil chat' CLI command, in which case we start up in | |
| 1177 | - chat-only mode. */ | |
| 1171 | + if( window.fossil.config.chat.fromcli ){ | |
| 1178 | 1172 | Chat.chatOnlyMode(true); |
| 1179 | 1173 | } |
| 1180 | 1174 | |
| 1181 | 1175 | F.page.chat = Chat/* enables testing the APIs via the dev tools */; |
| 1182 | 1176 | })(); |
| 1183 | 1177 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -355,20 +355,20 @@ | |
| 355 | defaults:{ |
| 356 | "images-inline": !!F.config.chat.imagesInline, |
| 357 | "edit-multiline": false, |
| 358 | "monospace-messages": false, |
| 359 | "chat-only-mode": false, |
| 360 | "audio-notification": true, |
| 361 | } |
| 362 | }, |
| 363 | /** Plays a new-message notification sound IF the audio-notification |
| 364 | setting is true, else this is a no-op. Returns this. |
| 365 | */ |
| 366 | playNewMessageSound: function f(){ |
| 367 | if(this.settings.getBool('audio-notification',false)){ |
| 368 | try{ |
| 369 | if(!f.audio) f.audio = new Audio(F.rootPath+"chat-audio-received"); |
| 370 | f.audio.currentTime = 0; |
| 371 | f.audio.play(); |
| 372 | }catch(e){ |
| 373 | console.error("Audio playblack failed.",e); |
| 374 | } |
| @@ -934,17 +934,17 @@ | |
| 934 | const v = Chat.settings.getBool('images-inline',true); |
| 935 | Chat.settings.set('images-inline', !v); |
| 936 | F.toast.message("Image mode set to "+(v ? "hyperlink" : "inline")+"."); |
| 937 | } |
| 938 | },{ |
| 939 | label: "Audio notifications", |
| 940 | boolValue: ()=>Chat.settings.getBool('audio-notification'), |
| 941 | callback: function(){ |
| 942 | const v = Chat.settings.getBool('audio-notification'); |
| 943 | Chat.settings.set('audio-notification', !v); |
| 944 | if(!v){ |
| 945 | setTimeout(()=>Chat.playNewMessageSound(), 500); |
| 946 | } |
| 947 | F.toast.message("Audio notifications "+(v ? "disabled" : "enabled")+"."); |
| 948 | } |
| 949 | }]; |
| 950 | |
| @@ -1057,13 +1057,10 @@ | |
| 1057 | Chat.changesSincePageHidden += jx.msgs.length; |
| 1058 | if(jx.msgs.length){ |
| 1059 | Chat.e.pageTitle.innerText = '[*] '+Chat.pageTitleOrig; |
| 1060 | } |
| 1061 | } |
| 1062 | if(jx.msgs.length && F.config.chat.pingTcp){ |
| 1063 | fetch("http:/"+"/localhost:"+F.config.chat.pingTcp+"/chat-ping"); |
| 1064 | } |
| 1065 | }/*newcontent()*/; |
| 1066 | Chat.newContent = newcontent; |
| 1067 | |
| 1068 | (function(){ |
| 1069 | /** Add toolbar for loading older messages. We use a FIELDSET here |
| @@ -1169,14 +1166,11 @@ | |
| 1169 | Chat._gotServerError = poll.running = false; |
| 1170 | poll(true); |
| 1171 | if(!Chat._gotServerError){ |
| 1172 | Chat.intervalTimer = setInterval(poll, 1000); |
| 1173 | } |
| 1174 | if(/\bping=\d+/.test(window.location.search)){ |
| 1175 | /* If we see the 'ping' parameter we're certain this was run via |
| 1176 | the 'fossil chat' CLI command, in which case we start up in |
| 1177 | chat-only mode. */ |
| 1178 | Chat.chatOnlyMode(true); |
| 1179 | } |
| 1180 | |
| 1181 | F.page.chat = Chat/* enables testing the APIs via the dev tools */; |
| 1182 | })(); |
| 1183 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -355,20 +355,20 @@ | |
| 355 | defaults:{ |
| 356 | "images-inline": !!F.config.chat.imagesInline, |
| 357 | "edit-multiline": false, |
| 358 | "monospace-messages": false, |
| 359 | "chat-only-mode": false, |
| 360 | "audible-alert": true, |
| 361 | } |
| 362 | }, |
| 363 | /** Plays a new-message notification sound IF the audible-alert |
| 364 | setting is true, else this is a no-op. Returns this. |
| 365 | */ |
| 366 | playNewMessageSound: function f(){ |
| 367 | if(this.settings.getBool('audible-alert',false)){ |
| 368 | try{ |
| 369 | if(!f.audio) f.audio = new Audio(F.rootPath+"chat-alert"); |
| 370 | f.audio.currentTime = 0; |
| 371 | f.audio.play(); |
| 372 | }catch(e){ |
| 373 | console.error("Audio playblack failed.",e); |
| 374 | } |
| @@ -934,17 +934,17 @@ | |
| 934 | const v = Chat.settings.getBool('images-inline',true); |
| 935 | Chat.settings.set('images-inline', !v); |
| 936 | F.toast.message("Image mode set to "+(v ? "hyperlink" : "inline")+"."); |
| 937 | } |
| 938 | },{ |
| 939 | label: "Audible alerts", |
| 940 | boolValue: ()=>Chat.settings.getBool('audible-alert'), |
| 941 | callback: function(){ |
| 942 | const v = Chat.settings.getBool('audible-alert'); |
| 943 | Chat.settings.set('audible-alert', !v); |
| 944 | if(!v){ |
| 945 | setTimeout(()=>Chat.playNewMessageSound(), 50); |
| 946 | } |
| 947 | F.toast.message("Audio notifications "+(v ? "disabled" : "enabled")+"."); |
| 948 | } |
| 949 | }]; |
| 950 | |
| @@ -1057,13 +1057,10 @@ | |
| 1057 | Chat.changesSincePageHidden += jx.msgs.length; |
| 1058 | if(jx.msgs.length){ |
| 1059 | Chat.e.pageTitle.innerText = '[*] '+Chat.pageTitleOrig; |
| 1060 | } |
| 1061 | } |
| 1062 | }/*newcontent()*/; |
| 1063 | Chat.newContent = newcontent; |
| 1064 | |
| 1065 | (function(){ |
| 1066 | /** Add toolbar for loading older messages. We use a FIELDSET here |
| @@ -1169,14 +1166,11 @@ | |
| 1166 | Chat._gotServerError = poll.running = false; |
| 1167 | poll(true); |
| 1168 | if(!Chat._gotServerError){ |
| 1169 | Chat.intervalTimer = setInterval(poll, 1000); |
| 1170 | } |
| 1171 | if( window.fossil.config.chat.fromcli ){ |
| 1172 | Chat.chatOnlyMode(true); |
| 1173 | } |
| 1174 | |
| 1175 | F.page.chat = Chat/* enables testing the APIs via the dev tools */; |
| 1176 | })(); |
| 1177 |
+1
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1179,11 +1179,11 @@ | ||
| 1179 | 1179 | char *zFile; |
| 1180 | 1180 | Blob reply, line; |
| 1181 | 1181 | char *zComment; |
| 1182 | 1182 | int i; |
| 1183 | 1183 | |
| 1184 | - zEditor = fossil_text_editor();db_get("editor", 0); | |
| 1184 | + zEditor = fossil_text_editor(); | |
| 1185 | 1185 | if( zEditor==0 ){ |
| 1186 | 1186 | if( blob_size(pPrompt)>0 ){ |
| 1187 | 1187 | blob_append(pPrompt, |
| 1188 | 1188 | "#\n" |
| 1189 | 1189 | "# Since no default text editor is set using EDITOR or VISUAL\n" |
| 1190 | 1190 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1179,11 +1179,11 @@ | |
| 1179 | char *zFile; |
| 1180 | Blob reply, line; |
| 1181 | char *zComment; |
| 1182 | int i; |
| 1183 | |
| 1184 | zEditor = fossil_text_editor();db_get("editor", 0); |
| 1185 | if( zEditor==0 ){ |
| 1186 | if( blob_size(pPrompt)>0 ){ |
| 1187 | blob_append(pPrompt, |
| 1188 | "#\n" |
| 1189 | "# Since no default text editor is set using EDITOR or VISUAL\n" |
| 1190 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1179,11 +1179,11 @@ | |
| 1179 | char *zFile; |
| 1180 | Blob reply, line; |
| 1181 | char *zComment; |
| 1182 | int i; |
| 1183 | |
| 1184 | zEditor = fossil_text_editor(); |
| 1185 | if( zEditor==0 ){ |
| 1186 | if( blob_size(pPrompt)>0 ){ |
| 1187 | blob_append(pPrompt, |
| 1188 | "#\n" |
| 1189 | "# Since no default text editor is set using EDITOR or VISUAL\n" |
| 1190 |
+4
-51
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2657,35 +2657,10 @@ | ||
| 2657 | 2657 | cgi_handle_http_request(0); |
| 2658 | 2658 | process_one_web_page(0, 0, 1); |
| 2659 | 2659 | } |
| 2660 | 2660 | } |
| 2661 | 2661 | |
| 2662 | -#if !defined(_WIN32) | |
| 2663 | -#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__) | |
| 2664 | -/* | |
| 2665 | -** Search for an executable on the PATH environment variable. | |
| 2666 | -** Return true (1) if found and false (0) if not found. | |
| 2667 | -*/ | |
| 2668 | -static int binaryOnPath(const char *zBinary){ | |
| 2669 | - const char *zPath = fossil_getenv("PATH"); | |
| 2670 | - char *zFull; | |
| 2671 | - int i; | |
| 2672 | - int bExists; | |
| 2673 | - while( zPath && zPath[0] ){ | |
| 2674 | - while( zPath[0]==':' ) zPath++; | |
| 2675 | - for(i=0; zPath[i] && zPath[i]!=':'; i++){} | |
| 2676 | - zFull = mprintf("%.*s/%s", i, zPath, zBinary); | |
| 2677 | - bExists = file_access(zFull, X_OK); | |
| 2678 | - fossil_free(zFull); | |
| 2679 | - if( bExists==0 ) return 1; | |
| 2680 | - zPath += i; | |
| 2681 | - } | |
| 2682 | - return 0; | |
| 2683 | -} | |
| 2684 | -#endif | |
| 2685 | -#endif | |
| 2686 | - | |
| 2687 | 2662 | /* |
| 2688 | 2663 | ** Respond to a SIGALRM by writing a message to the error log (if there |
| 2689 | 2664 | ** is one) and exiting. |
| 2690 | 2665 | */ |
| 2691 | 2666 | #ifndef _WIN32 |
| @@ -2807,11 +2782,10 @@ | ||
| 2807 | 2782 | const char *zAltBase; /* Argument to the --baseurl option */ |
| 2808 | 2783 | const char *zFileGlob; /* Static content must match this */ |
| 2809 | 2784 | char *zIpAddr = 0; /* Bind to this IP address */ |
| 2810 | 2785 | int fCreate = 0; /* The --create flag */ |
| 2811 | 2786 | const char *zInitPage = 0; /* Start on this page. --page option */ |
| 2812 | - const char *zChat = 0; /* Remote chat URL. (undocumented) */ | |
| 2813 | 2787 | |
| 2814 | 2788 | #if defined(_WIN32) |
| 2815 | 2789 | const char *zStopperFile; /* Name of file used to terminate server */ |
| 2816 | 2790 | zStopperFile = find_option("stopper", 0, 1); |
| 2817 | 2791 | #endif |
| @@ -2855,11 +2829,10 @@ | ||
| 2855 | 2829 | cgi_replace_parameter("HTTPS","on"); |
| 2856 | 2830 | } |
| 2857 | 2831 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2858 | 2832 | flags |= HTTP_SERVER_LOCALHOST; |
| 2859 | 2833 | } |
| 2860 | - zChat = find_option("internal-chat-url",0,1); | |
| 2861 | 2834 | |
| 2862 | 2835 | /* We should be done with options.. */ |
| 2863 | 2836 | verify_all_options(); |
| 2864 | 2837 | |
| 2865 | 2838 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| @@ -2895,30 +2868,12 @@ | ||
| 2895 | 2868 | mxPort = iPort+100; |
| 2896 | 2869 | } |
| 2897 | 2870 | #if !defined(_WIN32) |
| 2898 | 2871 | /* Unix implementation */ |
| 2899 | 2872 | if( isUiCmd ){ |
| 2900 | -#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__) | |
| 2901 | - zBrowser = db_get("web-browser", 0); | |
| 2902 | - if( zBrowser==0 ){ | |
| 2903 | - static const char *const azBrowserProg[] = | |
| 2904 | - { "xdg-open", "gnome-open", "firefox", "google-chrome" }; | |
| 2905 | - int i; | |
| 2906 | - zBrowser = "echo"; | |
| 2907 | - for(i=0; i<count(azBrowserProg); i++){ | |
| 2908 | - if( binaryOnPath(azBrowserProg[i]) ){ | |
| 2909 | - zBrowser = azBrowserProg[i]; | |
| 2910 | - break; | |
| 2911 | - } | |
| 2912 | - } | |
| 2913 | - } | |
| 2914 | -#else | |
| 2915 | - zBrowser = db_get("web-browser", "open"); | |
| 2916 | -#endif | |
| 2917 | - if( zChat ){ | |
| 2918 | - zBrowserCmd = mprintf("%s \"%s\" &", zBrowser, zChat); | |
| 2919 | - }else if( zIpAddr==0 ){ | |
| 2873 | + zBrowser = fossil_web_browser(); | |
| 2874 | + if( zIpAddr==0 ){ | |
| 2920 | 2875 | zBrowserCmd = mprintf("%s \"http://localhost:%%d/%s\" &", |
| 2921 | 2876 | zBrowser, zInitPage); |
| 2922 | 2877 | }else if( strchr(zIpAddr,':') ){ |
| 2923 | 2878 | zBrowserCmd = mprintf("%s \"http://[%s]:%%d/%s\" &", |
| 2924 | 2879 | zBrowser, zIpAddr, zInitPage); |
| @@ -2976,14 +2931,12 @@ | ||
| 2976 | 2931 | getpid()); |
| 2977 | 2932 | } |
| 2978 | 2933 | #else |
| 2979 | 2934 | /* Win32 implementation */ |
| 2980 | 2935 | if( isUiCmd ){ |
| 2981 | - zBrowser = db_get("web-browser", "start"); | |
| 2982 | - if( zChat ){ | |
| 2983 | - zBrowserCmd = mprintf("%s %s &", zBrowser, zChat); | |
| 2984 | - }else if( zIpAddr==0 ){ | |
| 2936 | + zBrowser = fossil_web_browser(); | |
| 2937 | + if( zIpAddr==0 ){ | |
| 2985 | 2938 | zBrowserCmd = mprintf("%s http://localhost:%%d/%s &", |
| 2986 | 2939 | zBrowser, zInitPage); |
| 2987 | 2940 | }else if( strchr(zIpAddr,':') ){ |
| 2988 | 2941 | zBrowserCmd = mprintf("%s http://[%s]:%%d/%s &", |
| 2989 | 2942 | zBrowser, zIpAddr, zInitPage); |
| 2990 | 2943 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2657,35 +2657,10 @@ | |
| 2657 | cgi_handle_http_request(0); |
| 2658 | process_one_web_page(0, 0, 1); |
| 2659 | } |
| 2660 | } |
| 2661 | |
| 2662 | #if !defined(_WIN32) |
| 2663 | #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__) |
| 2664 | /* |
| 2665 | ** Search for an executable on the PATH environment variable. |
| 2666 | ** Return true (1) if found and false (0) if not found. |
| 2667 | */ |
| 2668 | static int binaryOnPath(const char *zBinary){ |
| 2669 | const char *zPath = fossil_getenv("PATH"); |
| 2670 | char *zFull; |
| 2671 | int i; |
| 2672 | int bExists; |
| 2673 | while( zPath && zPath[0] ){ |
| 2674 | while( zPath[0]==':' ) zPath++; |
| 2675 | for(i=0; zPath[i] && zPath[i]!=':'; i++){} |
| 2676 | zFull = mprintf("%.*s/%s", i, zPath, zBinary); |
| 2677 | bExists = file_access(zFull, X_OK); |
| 2678 | fossil_free(zFull); |
| 2679 | if( bExists==0 ) return 1; |
| 2680 | zPath += i; |
| 2681 | } |
| 2682 | return 0; |
| 2683 | } |
| 2684 | #endif |
| 2685 | #endif |
| 2686 | |
| 2687 | /* |
| 2688 | ** Respond to a SIGALRM by writing a message to the error log (if there |
| 2689 | ** is one) and exiting. |
| 2690 | */ |
| 2691 | #ifndef _WIN32 |
| @@ -2807,11 +2782,10 @@ | |
| 2807 | const char *zAltBase; /* Argument to the --baseurl option */ |
| 2808 | const char *zFileGlob; /* Static content must match this */ |
| 2809 | char *zIpAddr = 0; /* Bind to this IP address */ |
| 2810 | int fCreate = 0; /* The --create flag */ |
| 2811 | const char *zInitPage = 0; /* Start on this page. --page option */ |
| 2812 | const char *zChat = 0; /* Remote chat URL. (undocumented) */ |
| 2813 | |
| 2814 | #if defined(_WIN32) |
| 2815 | const char *zStopperFile; /* Name of file used to terminate server */ |
| 2816 | zStopperFile = find_option("stopper", 0, 1); |
| 2817 | #endif |
| @@ -2855,11 +2829,10 @@ | |
| 2855 | cgi_replace_parameter("HTTPS","on"); |
| 2856 | } |
| 2857 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2858 | flags |= HTTP_SERVER_LOCALHOST; |
| 2859 | } |
| 2860 | zChat = find_option("internal-chat-url",0,1); |
| 2861 | |
| 2862 | /* We should be done with options.. */ |
| 2863 | verify_all_options(); |
| 2864 | |
| 2865 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| @@ -2895,30 +2868,12 @@ | |
| 2895 | mxPort = iPort+100; |
| 2896 | } |
| 2897 | #if !defined(_WIN32) |
| 2898 | /* Unix implementation */ |
| 2899 | if( isUiCmd ){ |
| 2900 | #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__) |
| 2901 | zBrowser = db_get("web-browser", 0); |
| 2902 | if( zBrowser==0 ){ |
| 2903 | static const char *const azBrowserProg[] = |
| 2904 | { "xdg-open", "gnome-open", "firefox", "google-chrome" }; |
| 2905 | int i; |
| 2906 | zBrowser = "echo"; |
| 2907 | for(i=0; i<count(azBrowserProg); i++){ |
| 2908 | if( binaryOnPath(azBrowserProg[i]) ){ |
| 2909 | zBrowser = azBrowserProg[i]; |
| 2910 | break; |
| 2911 | } |
| 2912 | } |
| 2913 | } |
| 2914 | #else |
| 2915 | zBrowser = db_get("web-browser", "open"); |
| 2916 | #endif |
| 2917 | if( zChat ){ |
| 2918 | zBrowserCmd = mprintf("%s \"%s\" &", zBrowser, zChat); |
| 2919 | }else if( zIpAddr==0 ){ |
| 2920 | zBrowserCmd = mprintf("%s \"http://localhost:%%d/%s\" &", |
| 2921 | zBrowser, zInitPage); |
| 2922 | }else if( strchr(zIpAddr,':') ){ |
| 2923 | zBrowserCmd = mprintf("%s \"http://[%s]:%%d/%s\" &", |
| 2924 | zBrowser, zIpAddr, zInitPage); |
| @@ -2976,14 +2931,12 @@ | |
| 2976 | getpid()); |
| 2977 | } |
| 2978 | #else |
| 2979 | /* Win32 implementation */ |
| 2980 | if( isUiCmd ){ |
| 2981 | zBrowser = db_get("web-browser", "start"); |
| 2982 | if( zChat ){ |
| 2983 | zBrowserCmd = mprintf("%s %s &", zBrowser, zChat); |
| 2984 | }else if( zIpAddr==0 ){ |
| 2985 | zBrowserCmd = mprintf("%s http://localhost:%%d/%s &", |
| 2986 | zBrowser, zInitPage); |
| 2987 | }else if( strchr(zIpAddr,':') ){ |
| 2988 | zBrowserCmd = mprintf("%s http://[%s]:%%d/%s &", |
| 2989 | zBrowser, zIpAddr, zInitPage); |
| 2990 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2657,35 +2657,10 @@ | |
| 2657 | cgi_handle_http_request(0); |
| 2658 | process_one_web_page(0, 0, 1); |
| 2659 | } |
| 2660 | } |
| 2661 | |
| 2662 | /* |
| 2663 | ** Respond to a SIGALRM by writing a message to the error log (if there |
| 2664 | ** is one) and exiting. |
| 2665 | */ |
| 2666 | #ifndef _WIN32 |
| @@ -2807,11 +2782,10 @@ | |
| 2782 | const char *zAltBase; /* Argument to the --baseurl option */ |
| 2783 | const char *zFileGlob; /* Static content must match this */ |
| 2784 | char *zIpAddr = 0; /* Bind to this IP address */ |
| 2785 | int fCreate = 0; /* The --create flag */ |
| 2786 | const char *zInitPage = 0; /* Start on this page. --page option */ |
| 2787 | |
| 2788 | #if defined(_WIN32) |
| 2789 | const char *zStopperFile; /* Name of file used to terminate server */ |
| 2790 | zStopperFile = find_option("stopper", 0, 1); |
| 2791 | #endif |
| @@ -2855,11 +2829,10 @@ | |
| 2829 | cgi_replace_parameter("HTTPS","on"); |
| 2830 | } |
| 2831 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2832 | flags |= HTTP_SERVER_LOCALHOST; |
| 2833 | } |
| 2834 | |
| 2835 | /* We should be done with options.. */ |
| 2836 | verify_all_options(); |
| 2837 | |
| 2838 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| @@ -2895,30 +2868,12 @@ | |
| 2868 | mxPort = iPort+100; |
| 2869 | } |
| 2870 | #if !defined(_WIN32) |
| 2871 | /* Unix implementation */ |
| 2872 | if( isUiCmd ){ |
| 2873 | zBrowser = fossil_web_browser(); |
| 2874 | if( zIpAddr==0 ){ |
| 2875 | zBrowserCmd = mprintf("%s \"http://localhost:%%d/%s\" &", |
| 2876 | zBrowser, zInitPage); |
| 2877 | }else if( strchr(zIpAddr,':') ){ |
| 2878 | zBrowserCmd = mprintf("%s \"http://[%s]:%%d/%s\" &", |
| 2879 | zBrowser, zIpAddr, zInitPage); |
| @@ -2976,14 +2931,12 @@ | |
| 2931 | getpid()); |
| 2932 | } |
| 2933 | #else |
| 2934 | /* Win32 implementation */ |
| 2935 | if( isUiCmd ){ |
| 2936 | zBrowser = fossil_web_browser(); |
| 2937 | if( zIpAddr==0 ){ |
| 2938 | zBrowserCmd = mprintf("%s http://localhost:%%d/%s &", |
| 2939 | zBrowser, zInitPage); |
| 2940 | }else if( strchr(zIpAddr,':') ){ |
| 2941 | zBrowserCmd = mprintf("%s http://[%s]:%%d/%s &", |
| 2942 | zBrowser, zIpAddr, zInitPage); |
| 2943 |
+1
-1
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -263,14 +263,14 @@ | ||
| 263 | 263 | $(SRCDIR)/sounds/8.wav \ |
| 264 | 264 | $(SRCDIR)/sounds/9.wav \ |
| 265 | 265 | $(SRCDIR)/sounds/a.wav \ |
| 266 | 266 | $(SRCDIR)/sounds/b.wav \ |
| 267 | 267 | $(SRCDIR)/sounds/c.wav \ |
| 268 | - $(SRCDIR)/sounds/chat-received.wav \ | |
| 269 | 268 | $(SRCDIR)/sounds/d.wav \ |
| 270 | 269 | $(SRCDIR)/sounds/e.wav \ |
| 271 | 270 | $(SRCDIR)/sounds/f.wav \ |
| 271 | + $(SRCDIR)/sounds/plunk.wav \ | |
| 272 | 272 | $(SRCDIR)/style.admin_log.css \ |
| 273 | 273 | $(SRCDIR)/style.fileedit.css \ |
| 274 | 274 | $(SRCDIR)/style.wikiedit.css \ |
| 275 | 275 | $(SRCDIR)/tree.js \ |
| 276 | 276 | $(SRCDIR)/useredit.js \ |
| 277 | 277 | |
| 278 | 278 | DELETED src/sounds/chat-received.wav |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -263,14 +263,14 @@ | |
| 263 | $(SRCDIR)/sounds/8.wav \ |
| 264 | $(SRCDIR)/sounds/9.wav \ |
| 265 | $(SRCDIR)/sounds/a.wav \ |
| 266 | $(SRCDIR)/sounds/b.wav \ |
| 267 | $(SRCDIR)/sounds/c.wav \ |
| 268 | $(SRCDIR)/sounds/chat-received.wav \ |
| 269 | $(SRCDIR)/sounds/d.wav \ |
| 270 | $(SRCDIR)/sounds/e.wav \ |
| 271 | $(SRCDIR)/sounds/f.wav \ |
| 272 | $(SRCDIR)/style.admin_log.css \ |
| 273 | $(SRCDIR)/style.fileedit.css \ |
| 274 | $(SRCDIR)/style.wikiedit.css \ |
| 275 | $(SRCDIR)/tree.js \ |
| 276 | $(SRCDIR)/useredit.js \ |
| 277 | |
| 278 | ELETED src/sounds/chat-received.wav |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -263,14 +263,14 @@ | |
| 263 | $(SRCDIR)/sounds/8.wav \ |
| 264 | $(SRCDIR)/sounds/9.wav \ |
| 265 | $(SRCDIR)/sounds/a.wav \ |
| 266 | $(SRCDIR)/sounds/b.wav \ |
| 267 | $(SRCDIR)/sounds/c.wav \ |
| 268 | $(SRCDIR)/sounds/d.wav \ |
| 269 | $(SRCDIR)/sounds/e.wav \ |
| 270 | $(SRCDIR)/sounds/f.wav \ |
| 271 | $(SRCDIR)/sounds/plunk.wav \ |
| 272 | $(SRCDIR)/style.admin_log.css \ |
| 273 | $(SRCDIR)/style.fileedit.css \ |
| 274 | $(SRCDIR)/style.wikiedit.css \ |
| 275 | $(SRCDIR)/tree.js \ |
| 276 | $(SRCDIR)/useredit.js \ |
| 277 | |
| 278 | ELETED src/sounds/chat-received.wav |
D
src/sounds/chat-received.wav
Binary file
+53
| --- src/util.c | ||
| +++ src/util.c | ||
| @@ -764,5 +764,58 @@ | ||
| 764 | 764 | int fossil_num_digits(int n){ |
| 765 | 765 | return n< 10 ? 1 : n< 100 ? 2 : n< 1000 ? 3 |
| 766 | 766 | : n< 10000 ? 4 : n< 100000 ? 5 : n< 1000000 ? 6 |
| 767 | 767 | : n<10000000 ? 7 : n<100000000 ? 8 : n<1000000000 ? 9 : 10; |
| 768 | 768 | } |
| 769 | + | |
| 770 | +#if !defined(_WIN32) | |
| 771 | +#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__) | |
| 772 | +/* | |
| 773 | +** Search for an executable on the PATH environment variable. | |
| 774 | +** Return true (1) if found and false (0) if not found. | |
| 775 | +*/ | |
| 776 | +static int binaryOnPath(const char *zBinary){ | |
| 777 | + const char *zPath = fossil_getenv("PATH"); | |
| 778 | + char *zFull; | |
| 779 | + int i; | |
| 780 | + int bExists; | |
| 781 | + while( zPath && zPath[0] ){ | |
| 782 | + while( zPath[0]==':' ) zPath++; | |
| 783 | + for(i=0; zPath[i] && zPath[i]!=':'; i++){} | |
| 784 | + zFull = mprintf("%.*s/%s", i, zPath, zBinary); | |
| 785 | + bExists = file_access(zFull, X_OK); | |
| 786 | + fossil_free(zFull); | |
| 787 | + if( bExists==0 ) return 1; | |
| 788 | + zPath += i; | |
| 789 | + } | |
| 790 | + return 0; | |
| 791 | +} | |
| 792 | +#endif | |
| 793 | +#endif | |
| 794 | + | |
| 795 | + | |
| 796 | +/* | |
| 797 | +** Return the name of a command that will launch a web-browser. | |
| 798 | +*/ | |
| 799 | +const char *fossil_web_browser(void){ | |
| 800 | + const char *zBrowser = 0; | |
| 801 | +#if defined(_WIN32) | |
| 802 | + zBrowser = db_get("web-browser", "start"); | |
| 803 | +#elif defined(__DARWIN__) || defined(__APPLE__) || defined(__HAIKU__) | |
| 804 | + zBrowser = db_get("web-browser", "open"); | |
| 805 | +#else | |
| 806 | + zBrowser = db_get("web-browser", 0); | |
| 807 | + if( zBrowser==0 ){ | |
| 808 | + static const char *const azBrowserProg[] = | |
| 809 | + { "xdg-open", "gnome-open", "firefox", "google-chrome" }; | |
| 810 | + int i; | |
| 811 | + zBrowser = "echo"; | |
| 812 | + for(i=0; i<count(azBrowserProg); i++){ | |
| 813 | + if( binaryOnPath(azBrowserProg[i]) ){ | |
| 814 | + zBrowser = azBrowserProg[i]; | |
| 815 | + break; | |
| 816 | + } | |
| 817 | + } | |
| 818 | + } | |
| 819 | +#endif | |
| 820 | + return zBrowser; | |
| 821 | +} | |
| 769 | 822 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -764,5 +764,58 @@ | |
| 764 | int fossil_num_digits(int n){ |
| 765 | return n< 10 ? 1 : n< 100 ? 2 : n< 1000 ? 3 |
| 766 | : n< 10000 ? 4 : n< 100000 ? 5 : n< 1000000 ? 6 |
| 767 | : n<10000000 ? 7 : n<100000000 ? 8 : n<1000000000 ? 9 : 10; |
| 768 | } |
| 769 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -764,5 +764,58 @@ | |
| 764 | int fossil_num_digits(int n){ |
| 765 | return n< 10 ? 1 : n< 100 ? 2 : n< 1000 ? 3 |
| 766 | : n< 10000 ? 4 : n< 100000 ? 5 : n< 1000000 ? 6 |
| 767 | : n<10000000 ? 7 : n<100000000 ? 8 : n<1000000000 ? 9 : 10; |
| 768 | } |
| 769 | |
| 770 | #if !defined(_WIN32) |
| 771 | #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__) |
| 772 | /* |
| 773 | ** Search for an executable on the PATH environment variable. |
| 774 | ** Return true (1) if found and false (0) if not found. |
| 775 | */ |
| 776 | static int binaryOnPath(const char *zBinary){ |
| 777 | const char *zPath = fossil_getenv("PATH"); |
| 778 | char *zFull; |
| 779 | int i; |
| 780 | int bExists; |
| 781 | while( zPath && zPath[0] ){ |
| 782 | while( zPath[0]==':' ) zPath++; |
| 783 | for(i=0; zPath[i] && zPath[i]!=':'; i++){} |
| 784 | zFull = mprintf("%.*s/%s", i, zPath, zBinary); |
| 785 | bExists = file_access(zFull, X_OK); |
| 786 | fossil_free(zFull); |
| 787 | if( bExists==0 ) return 1; |
| 788 | zPath += i; |
| 789 | } |
| 790 | return 0; |
| 791 | } |
| 792 | #endif |
| 793 | #endif |
| 794 | |
| 795 | |
| 796 | /* |
| 797 | ** Return the name of a command that will launch a web-browser. |
| 798 | */ |
| 799 | const char *fossil_web_browser(void){ |
| 800 | const char *zBrowser = 0; |
| 801 | #if defined(_WIN32) |
| 802 | zBrowser = db_get("web-browser", "start"); |
| 803 | #elif defined(__DARWIN__) || defined(__APPLE__) || defined(__HAIKU__) |
| 804 | zBrowser = db_get("web-browser", "open"); |
| 805 | #else |
| 806 | zBrowser = db_get("web-browser", 0); |
| 807 | if( zBrowser==0 ){ |
| 808 | static const char *const azBrowserProg[] = |
| 809 | { "xdg-open", "gnome-open", "firefox", "google-chrome" }; |
| 810 | int i; |
| 811 | zBrowser = "echo"; |
| 812 | for(i=0; i<count(azBrowserProg); i++){ |
| 813 | if( binaryOnPath(azBrowserProg[i]) ){ |
| 814 | zBrowser = azBrowserProg[i]; |
| 815 | break; |
| 816 | } |
| 817 | } |
| 818 | } |
| 819 | #endif |
| 820 | return zBrowser; |
| 821 | } |
| 822 |
+1
-1
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -675,14 +675,14 @@ | ||
| 675 | 675 | $(SRCDIR)/sounds/8.wav \ |
| 676 | 676 | $(SRCDIR)/sounds/9.wav \ |
| 677 | 677 | $(SRCDIR)/sounds/a.wav \ |
| 678 | 678 | $(SRCDIR)/sounds/b.wav \ |
| 679 | 679 | $(SRCDIR)/sounds/c.wav \ |
| 680 | - $(SRCDIR)/sounds/chat-received.wav \ | |
| 681 | 680 | $(SRCDIR)/sounds/d.wav \ |
| 682 | 681 | $(SRCDIR)/sounds/e.wav \ |
| 683 | 682 | $(SRCDIR)/sounds/f.wav \ |
| 683 | + $(SRCDIR)/sounds/plunk.wav \ | |
| 684 | 684 | $(SRCDIR)/style.admin_log.css \ |
| 685 | 685 | $(SRCDIR)/style.fileedit.css \ |
| 686 | 686 | $(SRCDIR)/style.wikiedit.css \ |
| 687 | 687 | $(SRCDIR)/tree.js \ |
| 688 | 688 | $(SRCDIR)/useredit.js \ |
| 689 | 689 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -675,14 +675,14 @@ | |
| 675 | $(SRCDIR)/sounds/8.wav \ |
| 676 | $(SRCDIR)/sounds/9.wav \ |
| 677 | $(SRCDIR)/sounds/a.wav \ |
| 678 | $(SRCDIR)/sounds/b.wav \ |
| 679 | $(SRCDIR)/sounds/c.wav \ |
| 680 | $(SRCDIR)/sounds/chat-received.wav \ |
| 681 | $(SRCDIR)/sounds/d.wav \ |
| 682 | $(SRCDIR)/sounds/e.wav \ |
| 683 | $(SRCDIR)/sounds/f.wav \ |
| 684 | $(SRCDIR)/style.admin_log.css \ |
| 685 | $(SRCDIR)/style.fileedit.css \ |
| 686 | $(SRCDIR)/style.wikiedit.css \ |
| 687 | $(SRCDIR)/tree.js \ |
| 688 | $(SRCDIR)/useredit.js \ |
| 689 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -675,14 +675,14 @@ | |
| 675 | $(SRCDIR)/sounds/8.wav \ |
| 676 | $(SRCDIR)/sounds/9.wav \ |
| 677 | $(SRCDIR)/sounds/a.wav \ |
| 678 | $(SRCDIR)/sounds/b.wav \ |
| 679 | $(SRCDIR)/sounds/c.wav \ |
| 680 | $(SRCDIR)/sounds/d.wav \ |
| 681 | $(SRCDIR)/sounds/e.wav \ |
| 682 | $(SRCDIR)/sounds/f.wav \ |
| 683 | $(SRCDIR)/sounds/plunk.wav \ |
| 684 | $(SRCDIR)/style.admin_log.css \ |
| 685 | $(SRCDIR)/style.fileedit.css \ |
| 686 | $(SRCDIR)/style.wikiedit.css \ |
| 687 | $(SRCDIR)/tree.js \ |
| 688 | $(SRCDIR)/useredit.js \ |
| 689 |
+2
-2
| --- win/Makefile.msc | ||
| +++ win/Makefile.msc | ||
| @@ -596,14 +596,14 @@ | ||
| 596 | 596 | "$(SRCDIR)\sounds\8.wav" \ |
| 597 | 597 | "$(SRCDIR)\sounds\9.wav" \ |
| 598 | 598 | "$(SRCDIR)\sounds\a.wav" \ |
| 599 | 599 | "$(SRCDIR)\sounds\b.wav" \ |
| 600 | 600 | "$(SRCDIR)\sounds\c.wav" \ |
| 601 | - "$(SRCDIR)\sounds\chat-received.wav" \ | |
| 602 | 601 | "$(SRCDIR)\sounds\d.wav" \ |
| 603 | 602 | "$(SRCDIR)\sounds\e.wav" \ |
| 604 | 603 | "$(SRCDIR)\sounds\f.wav" \ |
| 604 | + "$(SRCDIR)\sounds\plunk.wav" \ | |
| 605 | 605 | "$(SRCDIR)\style.admin_log.css" \ |
| 606 | 606 | "$(SRCDIR)\style.fileedit.css" \ |
| 607 | 607 | "$(SRCDIR)\style.wikiedit.css" \ |
| 608 | 608 | "$(SRCDIR)\tree.js" \ |
| 609 | 609 | "$(SRCDIR)\useredit.js" \ |
| @@ -1206,14 +1206,14 @@ | ||
| 1206 | 1206 | echo "$(SRCDIR)\sounds/8.wav" >> $@ |
| 1207 | 1207 | echo "$(SRCDIR)\sounds/9.wav" >> $@ |
| 1208 | 1208 | echo "$(SRCDIR)\sounds/a.wav" >> $@ |
| 1209 | 1209 | echo "$(SRCDIR)\sounds/b.wav" >> $@ |
| 1210 | 1210 | echo "$(SRCDIR)\sounds/c.wav" >> $@ |
| 1211 | - echo "$(SRCDIR)\sounds/chat-received.wav" >> $@ | |
| 1212 | 1211 | echo "$(SRCDIR)\sounds/d.wav" >> $@ |
| 1213 | 1212 | echo "$(SRCDIR)\sounds/e.wav" >> $@ |
| 1214 | 1213 | echo "$(SRCDIR)\sounds/f.wav" >> $@ |
| 1214 | + echo "$(SRCDIR)\sounds/plunk.wav" >> $@ | |
| 1215 | 1215 | echo "$(SRCDIR)\style.admin_log.css" >> $@ |
| 1216 | 1216 | echo "$(SRCDIR)\style.fileedit.css" >> $@ |
| 1217 | 1217 | echo "$(SRCDIR)\style.wikiedit.css" >> $@ |
| 1218 | 1218 | echo "$(SRCDIR)\tree.js" >> $@ |
| 1219 | 1219 | echo "$(SRCDIR)\useredit.js" >> $@ |
| 1220 | 1220 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -596,14 +596,14 @@ | |
| 596 | "$(SRCDIR)\sounds\8.wav" \ |
| 597 | "$(SRCDIR)\sounds\9.wav" \ |
| 598 | "$(SRCDIR)\sounds\a.wav" \ |
| 599 | "$(SRCDIR)\sounds\b.wav" \ |
| 600 | "$(SRCDIR)\sounds\c.wav" \ |
| 601 | "$(SRCDIR)\sounds\chat-received.wav" \ |
| 602 | "$(SRCDIR)\sounds\d.wav" \ |
| 603 | "$(SRCDIR)\sounds\e.wav" \ |
| 604 | "$(SRCDIR)\sounds\f.wav" \ |
| 605 | "$(SRCDIR)\style.admin_log.css" \ |
| 606 | "$(SRCDIR)\style.fileedit.css" \ |
| 607 | "$(SRCDIR)\style.wikiedit.css" \ |
| 608 | "$(SRCDIR)\tree.js" \ |
| 609 | "$(SRCDIR)\useredit.js" \ |
| @@ -1206,14 +1206,14 @@ | |
| 1206 | echo "$(SRCDIR)\sounds/8.wav" >> $@ |
| 1207 | echo "$(SRCDIR)\sounds/9.wav" >> $@ |
| 1208 | echo "$(SRCDIR)\sounds/a.wav" >> $@ |
| 1209 | echo "$(SRCDIR)\sounds/b.wav" >> $@ |
| 1210 | echo "$(SRCDIR)\sounds/c.wav" >> $@ |
| 1211 | echo "$(SRCDIR)\sounds/chat-received.wav" >> $@ |
| 1212 | echo "$(SRCDIR)\sounds/d.wav" >> $@ |
| 1213 | echo "$(SRCDIR)\sounds/e.wav" >> $@ |
| 1214 | echo "$(SRCDIR)\sounds/f.wav" >> $@ |
| 1215 | echo "$(SRCDIR)\style.admin_log.css" >> $@ |
| 1216 | echo "$(SRCDIR)\style.fileedit.css" >> $@ |
| 1217 | echo "$(SRCDIR)\style.wikiedit.css" >> $@ |
| 1218 | echo "$(SRCDIR)\tree.js" >> $@ |
| 1219 | echo "$(SRCDIR)\useredit.js" >> $@ |
| 1220 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -596,14 +596,14 @@ | |
| 596 | "$(SRCDIR)\sounds\8.wav" \ |
| 597 | "$(SRCDIR)\sounds\9.wav" \ |
| 598 | "$(SRCDIR)\sounds\a.wav" \ |
| 599 | "$(SRCDIR)\sounds\b.wav" \ |
| 600 | "$(SRCDIR)\sounds\c.wav" \ |
| 601 | "$(SRCDIR)\sounds\d.wav" \ |
| 602 | "$(SRCDIR)\sounds\e.wav" \ |
| 603 | "$(SRCDIR)\sounds\f.wav" \ |
| 604 | "$(SRCDIR)\sounds\plunk.wav" \ |
| 605 | "$(SRCDIR)\style.admin_log.css" \ |
| 606 | "$(SRCDIR)\style.fileedit.css" \ |
| 607 | "$(SRCDIR)\style.wikiedit.css" \ |
| 608 | "$(SRCDIR)\tree.js" \ |
| 609 | "$(SRCDIR)\useredit.js" \ |
| @@ -1206,14 +1206,14 @@ | |
| 1206 | echo "$(SRCDIR)\sounds/8.wav" >> $@ |
| 1207 | echo "$(SRCDIR)\sounds/9.wav" >> $@ |
| 1208 | echo "$(SRCDIR)\sounds/a.wav" >> $@ |
| 1209 | echo "$(SRCDIR)\sounds/b.wav" >> $@ |
| 1210 | echo "$(SRCDIR)\sounds/c.wav" >> $@ |
| 1211 | echo "$(SRCDIR)\sounds/d.wav" >> $@ |
| 1212 | echo "$(SRCDIR)\sounds/e.wav" >> $@ |
| 1213 | echo "$(SRCDIR)\sounds/f.wav" >> $@ |
| 1214 | echo "$(SRCDIR)\sounds/plunk.wav" >> $@ |
| 1215 | echo "$(SRCDIR)\style.admin_log.css" >> $@ |
| 1216 | echo "$(SRCDIR)\style.fileedit.css" >> $@ |
| 1217 | echo "$(SRCDIR)\style.wikiedit.css" >> $@ |
| 1218 | echo "$(SRCDIR)\tree.js" >> $@ |
| 1219 | echo "$(SRCDIR)\useredit.js" >> $@ |
| 1220 |