UIWindowLoginInProgress.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * Copyright (C) 2024 Puter Technologies Inc.
  3. *
  4. * This file is part of Puter.
  5. *
  6. * Puter is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as published
  8. * by the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. import UIWindow from './UIWindow.js'
  20. async function UIWindowLoginInProgress(options){
  21. return new Promise(async (resolve) => {
  22. options = options ?? {};
  23. let h = '';
  24. h += `<div class="login-progress">`;
  25. h += `<h1 style="text-align: center;
  26. font-size: 20px;
  27. padding: 10px;
  28. font-weight: 300; margin: -10px 10px 20px 10px;">Logging in as <strong>${options.user_info.email === null ? options.user_info.username : options.user_info.email}</strong></h1>`;
  29. // spinner
  30. h +=`<svg style="float:left; margin-right: 7px;" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24"><title>circle anim</title><g fill="#212121" class="nc-icon-wrapper"><g class="nc-loop-circle-24-icon-f"><path d="M12 24a12 12 0 1 1 12-12 12.013 12.013 0 0 1-12 12zm0-22a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2z" fill="#212121" opacity=".4"></path><path d="M24 12h-2A10.011 10.011 0 0 0 12 2V0a12.013 12.013 0 0 1 12 12z" data-color="color-2"></path></g><style>.nc-loop-circle-24-icon-f{--animation-duration:0.5s;transform-origin:12px 12px;animation:nc-loop-circle-anim var(--animation-duration) infinite linear}@keyframes nc-loop-circle-anim{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}</style></g></svg>`;
  31. h += `</div>`;
  32. const el_window = await UIWindow({
  33. title: 'Instant Login!',
  34. app: 'change-passowrd',
  35. single_instance: true,
  36. icon: null,
  37. uid: null,
  38. is_dir: false,
  39. body_content: h,
  40. draggable_body: false,
  41. has_head: false,
  42. selectable_body: false,
  43. draggable_body: false,
  44. allow_context_menu: false,
  45. is_resizable: false,
  46. is_droppable: false,
  47. init_center: true,
  48. allow_native_ctxmenu: false,
  49. allow_user_select: false,
  50. width: 350,
  51. height: 'auto',
  52. dominant: true,
  53. show_in_taskbar: false,
  54. backdrop: true,
  55. stay_on_top: true,
  56. onAppend: function(this_window){
  57. },
  58. window_class: 'window-login-progress',
  59. body_css: {
  60. width: 'initial',
  61. height: '100%',
  62. 'background-color': 'rgb(245 247 249)',
  63. 'backdrop-filter': 'blur(3px)',
  64. }
  65. })
  66. setTimeout(() => {
  67. $(el_window).close();
  68. }, 3000);
  69. })
  70. }
  71. export default UIWindowLoginInProgress