Fossil

Check-in [c23aa77411]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:/chat: Corrected storage of selected audio URI to account for multiple sounds. Updated change log and chat.md.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | chat-config-options
Files: files | file ages | folders
SHA3-256: c23aa77411fdb65e4329a67eeafa6163019982522e1639690dc252482a989880
User & Date: stephan 2021-09-18 03:26:43.089
Original Comment: /chat: re-enable inclusion of unversioned sound files (mp3, wav, ogg) in the list of chat notification sounds. Corrected storage of selected audio URI to account for multiple sounds. Updated change log and chat.md.
Context
2021-09-18
03:40
Reimplemented /chat settings selection to be more usable, device-portable, and extensible. Re-enabled client-side selection of repo-specific chat nofication sounds. check-in: 9c777150ed user: stephan tags: trunk
03:26
/chat: Corrected storage of selected audio URI to account for multiple sounds. Updated change log and chat.md. Closed-Leaf check-in: c23aa77411 user: stephan tags: chat-config-options
02:36
/chat: re-enable inclusion of unversioned sound files (mp3, wav, ogg) in the list of chat notification sounds. check-in: 2a59a9a15a user: stephan tags: chat-config-options
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/chat.js.
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
         repository-relative path which responds with an audio
         file). Pass a falsy value to disable audio alerts. Returns
         this.
      */
      setNewMessageSound: function f(uri){
        delete this.playNewMessageSound.audio;
        this.playNewMessageSound.uri = uri;
        this.settings.set('audible-alert', !!uri);
        return this;
      }
    };
    F.fetch.beforesend = ()=>cs.ajaxStart();
    F.fetch.aftersend = ()=>cs.ajaxEnd();
    cs.e.inputCurrent = cs.e.inputSingle;
    /* Install default settings... */







|







384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
         repository-relative path which responds with an audio
         file). Pass a falsy value to disable audio alerts. Returns
         this.
      */
      setNewMessageSound: function f(uri){
        delete this.playNewMessageSound.audio;
        this.playNewMessageSound.uri = uri;
        this.settings.set('audible-alert', uri);
        return this;
      }
    };
    F.fetch.beforesend = ()=>cs.ajaxStart();
    F.fetch.aftersend = ()=>cs.ajaxEnd();
    cs.e.inputCurrent = cs.e.inputSingle;
    /* Install default settings... */
1015
1016
1017
1018
1019
1020
1021
1022
1023

1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
      /* Disabled per chatroom discussion: selection list of audio files for
         chat notification. */
      settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
      const selectSound = D.select();
      D.append(settingsOps.selectSound,
               D.append(D.span(),"Audio alert"),
               selectSound);
      D.disable(D.option(selectSound, "0", "Audible alert..."));
      D.option(selectSound, "", "(no audio)");

      F.config.chat.alerts.forEach(function(a){
        D.option(selectSound, a);
      });
      if(true===Chat.settings.getBool('audible-alert')){
        selectSound.selectedIndex = 2/*first audio file in the list*/;
      }else{
        selectSound.value = Chat.settings.get('audible-alert','');
        if(selectSound.selectedIndex<0){
          /*Missing file - removed after this setting was applied. Fall back
            to the first sound in the list. */
          selectSound.selectedIndex = 2;
        }
      }
      selectSound.addEventListener('change',function(){
        const v = this.selectedIndex>1 ? this.value : '';
        Chat.setNewMessageSound(v);
        F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
        if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
      }, false);
      Chat.setNewMessageSound(selectSound.value);
    }/*audio notification config*/
    /**







<

>




|





|



|







1015
1016
1017
1018
1019
1020
1021

1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
      /* Disabled per chatroom discussion: selection list of audio files for
         chat notification. */
      settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
      const selectSound = D.select();
      D.append(settingsOps.selectSound,
               D.append(D.span(),"Audio alert"),
               selectSound);

      D.option(selectSound, "", "(no audio)");
      const firstSoundIndex = selectSound.options.length;
      F.config.chat.alerts.forEach(function(a){
        D.option(selectSound, a);
      });
      if(true===Chat.settings.getBool('audible-alert')){
        selectSound.selectedIndex = firstSoundIndex;
      }else{
        selectSound.value = Chat.settings.get('audible-alert','');
        if(selectSound.selectedIndex<0){
          /*Missing file - removed after this setting was applied. Fall back
            to the first sound in the list. */
          selectSound.selectedIndex = firstSoundIndex;
        }
      }
      selectSound.addEventListener('change',function(){
        const v = this.value;
        Chat.setNewMessageSound(v);
        F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
        if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
      }, false);
      Chat.setNewMessageSound(selectSound.value);
    }/*audio notification config*/
    /**
1072
1073
1074
1075
1076
1077
1078

1079
1080
1081
1082
1083
1084
1085
      }
      D.append(line, btn);
      D.append(optionsMenu, line);
    });
    if(settingsOps.selectSound){
      D.append(optionsMenu, settingsOps.selectSound);
    }

  })()/*#chat-settings-button setup*/;
  
  /** Callback for poll() to inject new content into the page.  jx ==
      the response from /chat-poll. If atEnd is true, the message is
      appended to the end of the chat list (for loading older
      messages), else the beginning (the default). */
  const newcontent = function f(jx,atEnd){







>







1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
      }
      D.append(line, btn);
      D.append(optionsMenu, line);
    });
    if(settingsOps.selectSound){
      D.append(optionsMenu, settingsOps.selectSound);
    }
    //settingsButton.click()/*for for development*/;
  })()/*#chat-settings-button setup*/;
  
  /** Callback for poll() to inject new content into the page.  jx ==
      the response from /chat-poll. If atEnd is true, the message is
      appended to the end of the chat list (for loading older
      messages), else the beginning (the default). */
  const newcontent = function f(jx,atEnd){
Changes to src/default.css.
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
  flex-direction: column;
  overflow: auto;
}
body.chat #chat-config #chat-config-options .menu-entry {
  display: flex;
  align-items: center;
  flex-direction: row;
  flex-wrap: nowrap;
  padding: 1em;
}
body.chat #chat-config #chat-config-options .menu-entry > *:first-child {
  margin-right: 1em;
}
input[type="checkbox"].diff-toggle {
  float: right;







|







1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
  flex-direction: column;
  overflow: auto;
}
body.chat #chat-config #chat-config-options .menu-entry {
  display: flex;
  align-items: center;
  flex-direction: row;
  flex-wrap: wrap;
  padding: 1em;
}
body.chat #chat-config #chat-config-options .menu-entry > *:first-child {
  margin-right: 1em;
}
input[type="checkbox"].diff-toggle {
  float: right;
Changes to www/changes.wiki.
34
35
36
37
38
39
40



41
42
43
44
45
46
47
     block HTML markup (such as &lt;table&gt;) in most cases.  Only content
     of &lt;pre&gt; and &lt;script&gt; is passed through verbatim.
  *  The [/help?cmd=wiki|wiki list command] no longer lists "deleted"
     pages by default. Use the new <tt>--all</tt> option to include deleted
     pages in the output.
  *  The [/help?cmd=all|fossil all git status] command only shows reports for
     the subset of repositories that have a configured Git export.




<h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2>
  *  <b>Security:</b> Fix the client-side TLS so that it verifies that the
     server hostname matches its certificate.
  *  The default "ssh" command on Windows is changed to "ssh" instead of the
     legacy "plink", as ssh is now generally available on Windows systems.
     Installations that still need to use the legacy "plink" can make that







>
>
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
     block HTML markup (such as &lt;table&gt;) in most cases.  Only content
     of &lt;pre&gt; and &lt;script&gt; is passed through verbatim.
  *  The [/help?cmd=wiki|wiki list command] no longer lists "deleted"
     pages by default. Use the new <tt>--all</tt> option to include deleted
     pages in the output.
  *  The [/help?cmd=all|fossil all git status] command only shows reports for
     the subset of repositories that have a configured Git export.
  *  Enhanced the [/help?cmd=/chat|/chat page] configuration and added the ability
     for a repository administrator to [./chat.md#notifications|extend the
     selection of notification sounds via unversioned files].

<h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2>
  *  <b>Security:</b> Fix the client-side TLS so that it verifies that the
     server hostname matches its certificate.
  *  The default "ssh" command on Windows is changed to "ssh" instead of the
     legacy "plink", as ssh is now generally available on Windows systems.
     Installations that still need to use the legacy "plink" can make that
Changes to www/chat.md.
97
98
99
100
101
102
103








104
105
106
107
108
109
110
at the top of the message and clicking the button which appears. Such
deletions are local-only, and the messages will reappear if the page
is reloaded. The user who posted a given message, or any Admin users,
may additionally choose to globally delete a message from the chat
record, which deletes it not only from their own browser but also
propagates the removal to all connected clients the next time they
poll for new messages.









## Implementation Details

*You do not need to understand how Fossil chat works in order to use it.
But many developers prefer to know how their tools work.
This section is provided for the benefit of those curious developers.*








>
>
>
>
>
>
>
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
at the top of the message and clicking the button which appears. Such
deletions are local-only, and the messages will reappear if the page
is reloaded. The user who posted a given message, or any Admin users,
may additionally choose to globally delete a message from the chat
record, which deletes it not only from their own browser but also
propagates the removal to all connected clients the next time they
poll for new messages.

### <a id='notifications'></a>Customizing New-message Notification Sounds

By default, the list of new-message notification sounds is limited to
a few built in to the fossil binary. In addition, any
[unversioned files](./unvers.wiki) named `alert-sounds/*.{mp3,wav,ogg}`
will be included in that list. To switch sounds, tap the "settings"
button.

## Implementation Details

*You do not need to understand how Fossil chat works in order to use it.
But many developers prefer to know how their tools work.
This section is provided for the benefit of those curious developers.*