Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. *** some.js 2021-12-23
  2. --- some.js 2021-12-24
  3. ***************
  4. *** 2021,2027 ****
  5.           consultant_service_pid = inputs.consultant_service_pid;
  6.     const rsa_public_key = make_rsa_public_key(crypto.rsa_modulus_hex);
  7.     const other_users_array = array_to_obj(consultant_chat_other_users_schema, psv_to_array(inputs.consultant_chat_other_users)).array;
  8. !   const consultant_chat_info = generate_new_consultant_chat_info(rsa_public_key, inputs.consultant_service_pid, other_users_array);
  9.     assert(consultant_chat_info.consultant_service_pid === inputs.consultant_service_pid);
  10.       }
  11.      
  12. --- 2021,2027 ----
  13.           consultant_service_pid = inputs.consultant_service_pid;
  14.     const rsa_public_key = make_rsa_public_key(crypto.rsa_modulus_hex);
  15.     const other_users_array = array_to_obj(consultant_chat_other_users_schema, psv_to_array(inputs.consultant_chat_other_users)).array;
  16. !   consultant_chat_info = generate_new_consultant_chat_info(rsa_public_key, inputs.consultant_service_pid, other_users_array);
  17.     assert(consultant_chat_info.consultant_service_pid === inputs.consultant_service_pid);
  18.       }
  19.      
  20. ***************
  21. *** 4419,4429 ****
  22.     let dialog = show_dialog();
  23.     basic_data_post('/file_list', obj_to_uri({}), function(success, info, data_psv)
  24.                       {
  25. !                         const values = psv_to_array(data_psv);
  26.                           let files = [];
  27. !                         for (let i = 0; i < values.length; i += 2) {
  28. !                             const pid = values[i + 0];
  29. !                             const name = values[i + 1];
  30.                               files.push({
  31.                                              t: 'a', classes: 'attach_file_list_file',
  32.                                              children: [
  33. --- 4419,4432 ----
  34.     let dialog = show_dialog();
  35.     basic_data_post('/file_list', obj_to_uri({}), function(success, info, data_psv)
  36.                       {
  37. !                         const schema = [ {
  38. !                                             type: 'array', name: 'items', schema: [ 'pid', 'name' ]
  39. !                                             }];
  40. !                         const items = array_to_obj(schema, psv_to_array(data_psv)).items;
  41.                           let files = [];
  42. !                         for (let i = 0; i < items.length; ++i) {
  43. !                             const pid = items[i].pid;
  44. !                             const name = items[i].name;
  45.                               files.push({
  46.                                              t: 'a', classes: 'attach_file_list_file',
  47.                                              children: [
  48. ***************
  49. *** 6312,6349 ****
  50.                                        }
  51.                                    });
  52.      
  53. !       if (g_env.user_pid) {
  54. !           const script_init_data_schema = [
  55. !                                              {
  56. !                                                  type: 'array',
  57. !                                                  name: 'chats',
  58. !                                                  schema: [
  59. !                                                           'group_pid',
  60. !                                                           'last_other_msg_timestamp',
  61. !                                                           ]
  62. !                                              },
  63.                                                {
  64. !                                                  type: 'array',
  65. !                                                  name: 'groups',
  66. !                                                  schema: [
  67. !                                                           'group_pid',
  68. !                                                           ]
  69.                                                }
  70. -                                              ];
  71. -           const script_init_data_obj = array_to_obj(script_init_data_schema, psv_to_array(g_env.script_init_data));
  72. -           g_env.chat_init_data = script_init_data_obj.chats;
  73. -           g_env.groups_init_data = script_init_data_obj.groups;
  74.              
  75. !           const stored_status = window.localStorage.getItem('kv_store_' + KV_STORE_KEY_CHAT_STATUS);
  76. !           if (stored_status)
  77. !               g_env.kv_store_cache[KV_STORE_KEY_CHAT_STATUS] = JSON.parse(stored_status);
  78. !            
  79. !           const stored_timestamps = window.localStorage.getItem('kv_store_timestamps');
  80. !           if (stored_timestamps)
  81. !               g_env.kv_store_timestamps = JSON.parse(stored_timestamps);
  82. !            
  83. !           update_notifications();
  84.         }
  85.          
  86.         const try_start_push_notifications = function()
  87.           {
  88. --- 6315,6332 ----
  89.                                        }
  90.                                    });
  91.          
  92. !        
  93. !         window.addEventListener('focus', function()
  94.                                   {
  95. !                                     if (g_env.cur_chat_group_pid) {
  96. !                                         on_user_viewed_chat(g_env.cur_chat_group_pid);
  97.                                       }
  98.                                      
  99. !                                     if (g_env.has_title_alert) {
  100. !                                         clearInterval(g_env.title_alert_timer);
  101. !                                         document.title = g_env.saved_title;
  102.                                       }
  103. +                                 });
  104.          
  105.         const try_start_push_notifications = function()
  106.           {
  107. ***************
  108. *** 6409,6414 ****
  109. --- 6392,6429 ----
  110.           };
  111.           document.addEventListener('click', try_start_push_notifications);
  112.          
  113. +       if (g_env.user_pid) {
  114. +           const script_init_data_schema = [
  115. +                                              {
  116. +                                                  type: 'array',
  117. +                                                  name: 'chats',
  118. +                                                  schema: [
  119. +                                                           'group_pid',
  120. +                                                           'last_other_msg_timestamp',
  121. +                                                           ]
  122. +                                              },
  123. +                                              {
  124. +                                                  type: 'array',
  125. +                                                  name: 'groups',
  126. +                                                  schema: [
  127. +                                                           'group_pid',
  128. +                                                           ]
  129. +                                              }
  130. +                                              ];
  131. +           const script_init_data_obj = array_to_obj(script_init_data_schema, psv_to_array(g_env.script_init_data));
  132. +           g_env.chat_init_data = script_init_data_obj.chats;
  133. +           g_env.groups_init_data = script_init_data_obj.groups;
  134. +            
  135. +           const stored_status = window.localStorage.getItem('kv_store_' + KV_STORE_KEY_CHAT_STATUS);
  136. +           if (stored_status)
  137. +               g_env.kv_store_cache[KV_STORE_KEY_CHAT_STATUS] = JSON.parse(stored_status);
  138. +            
  139. +           const stored_timestamps = window.localStorage.getItem('kv_store_timestamps');
  140. +           if (stored_timestamps)
  141. +               g_env.kv_store_timestamps = JSON.parse(stored_timestamps);
  142. +            
  143. +           update_notifications();
  144. +         }
  145.          
  146.         let msg = window.sessionStorage.getItem('page_notification');
  147.         if (msg) {
  148. ***************
  149. *** 6417,6438 ****
  150.         }
  151.          
  152.         if (g_env.has_crypto_user) {
  153. -            
  154.             g_env.msg_sound = new Audio('/static/msg.ogg');
  155.             init_websocket();
  156.           }
  157.          
  158. !         window.addEventListener('focus', function()
  159. !                                 {
  160. !                                     if (g_env.cur_chat_group_pid) {
  161. !                                         on_user_viewed_chat(g_env.cur_chat_group_pid);
  162. !                                     }
  163. !                                    
  164. !                                     if (g_env.has_title_alert) {
  165. !                                         clearInterval(g_env.title_alert_timer);
  166. !                                         document.title = g_env.saved_title;
  167.                                       }
  168. -                                 });
  169.          
  170.           apply_js_to_elem_tree(document);
  171.       };
  172. --- 6432,6444 ----
  173.         }
  174.          
  175.         if (g_env.has_crypto_user) {
  176.             g_env.msg_sound = new Audio('/static/msg.ogg');
  177.             init_websocket();
  178.           }
  179.          
  180. !         if (!g_env.user_pid) {
  181. !             clear_local_session_data(function() { });
  182.           }
  183.          
  184.           apply_js_to_elem_tree(document);
  185.       };
  186. ***************
  187. *** 6543,6548 ****
  188.                               });
  189.   };
  190.  
  191. ! if (typeof window !== 'undefined') { // Prevent running in web worker
  192.       init();
  193.   }
  194. --- 6549,6554 ----
  195.                               });
  196.   };
  197.  
  198. ! if (typeof window !== 'undefined') { // Prevent running in service worker
  199.       init();
  200.   }