data.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. Copyright (C) 2025 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. export function setStatusData(data) {
  16. localStorage.setItem('status', JSON.stringify(data));
  17. localStorage.setItem('system_name', data.system_name);
  18. localStorage.setItem('logo', data.logo);
  19. localStorage.setItem('footer_html', data.footer_html);
  20. localStorage.setItem('quota_per_unit', data.quota_per_unit);
  21. // 兼容:保留旧字段,同时写入新的额度展示类型
  22. localStorage.setItem('display_in_currency', data.display_in_currency);
  23. localStorage.setItem('quota_display_type', data.quota_display_type || 'USD');
  24. localStorage.setItem('enable_drawing', data.enable_drawing);
  25. localStorage.setItem('enable_task', data.enable_task);
  26. localStorage.setItem('enable_data_export', data.enable_data_export);
  27. localStorage.setItem('chats', JSON.stringify(data.chats));
  28. localStorage.setItem(
  29. 'data_export_default_time',
  30. data.data_export_default_time,
  31. );
  32. localStorage.setItem(
  33. 'default_collapse_sidebar',
  34. data.default_collapse_sidebar,
  35. );
  36. localStorage.setItem('mj_notify_enabled', data.mj_notify_enabled);
  37. if (data.chat_link) {
  38. // localStorage.setItem('chat_link', data.chat_link);
  39. } else {
  40. localStorage.removeItem('chat_link');
  41. }
  42. if (data.chat_link2) {
  43. // localStorage.setItem('chat_link2', data.chat_link2);
  44. } else {
  45. localStorage.removeItem('chat_link2');
  46. }
  47. if (data.docs_link) {
  48. localStorage.setItem('docs_link', data.docs_link);
  49. } else {
  50. localStorage.removeItem('docs_link');
  51. }
  52. }
  53. export function setUserData(data) {
  54. localStorage.setItem('user', JSON.stringify(data));
  55. }