Run Safari patch before loading settings
| @@ -1,4 +1,4 @@ | |||
| 1 | import { humanizedDateTime, favsToHotswap, getMessageTimeStamp, dragElement, isMobile, initRossMods, shouldSendOnEnter } from './scripts/RossAscends-mods.js'; | 1 | import { humanizedDateTime, favsToHotswap, getMessageTimeStamp, dragElement, isMobile, initRossMods, shouldSendOnEnter, addSafariPatch } from './scripts/RossAscends-mods.js'; |
| 2 | import { userStatsHandler, statMesProcess, initStats } from './scripts/stats.js'; | 2 | import { userStatsHandler, statMesProcess, initStats } from './scripts/stats.js'; |
| 3 | import { | 3 | import { |
| 4 | generateKoboldWithStreaming, | 4 | generateKoboldWithStreaming, |
| @@ -916,6 +916,7 @@ async function firstLoadInit() { | |||
| 916 | throw new Error('Initialization failed'); | 916 | throw new Error('Initialization failed'); |
| 917 | } | 917 | } |
| 918 | 918 | ||
| 919 | addSafariPatch(); | ||
| 919 | await getClientVersion(); | 920 | await getClientVersion(); |
| 920 | await readSecretState(); | 921 | await readSecretState(); |
| 921 | initLocales(); | 922 | initLocales(); |
| @@ -6322,7 +6323,7 @@ export function setUserName(value) { | |||
| 6322 | 6323 | ||
| 6323 | async function doOnboarding(avatarId) { | 6324 | async function doOnboarding(avatarId) { |
| 6324 | const template = $('#onboarding_template .onboarding'); | 6325 | const template = $('#onboarding_template .onboarding'); |
| 6325 | let userName = await callGenericPopup(template, POPUP_TYPE.INPUT, currentUser?.name || name1, { rows: 2, wide: true, large: true }); | 6326 | let userName = await callGenericPopup(template, POPUP_TYPE.INPUT, currentUser?.name || name1, { rows: 2, wider: true, cancelButton: false }); |
| 6326 | 6327 | ||
| 6327 | if (userName) { | 6328 | if (userName) { |
| 6328 | userName = String(userName).replace('\n', ' '); | 6329 | userName = String(userName).replace('\n', ' '); |
| @@ -711,6 +711,18 @@ export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, deboun | |||
| 711 | 711 | ||
| 712 | // --------------------------------------------------- | 712 | // --------------------------------------------------- |
| 713 | 713 | ||
| 714 | export function addSafariPatch() { | ||
| 715 | const userAgent = getParsedUA(); | ||
| 716 | console.debug('User Agent', userAgent); | ||
| 717 | const isMobileSafari = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); | ||
| 718 | const isDesktopSafari = userAgent?.browser?.name === 'Safari' && userAgent?.platform?.type === 'desktop'; | ||
| 719 | const isIOS = userAgent?.os?.name === 'iOS'; | ||
| 720 | |||
| 721 | if (isIOS || isMobileSafari || isDesktopSafari) { | ||
| 722 | document.body.classList.add('safari'); | ||
| 723 | } | ||
| 724 | } | ||
| 725 | |||
| 714 | export function initRossMods() { | 726 | export function initRossMods() { |
| 715 | // initial status check | 727 | // initial status check |
| 716 | setTimeout(() => { | 728 | setTimeout(() => { |
| @@ -725,16 +737,6 @@ export function initRossMods() { | |||
| 725 | RA_autoconnect(); | 737 | RA_autoconnect(); |
| 726 | } | 738 | } |
| 727 | 739 | ||
| 728 | const userAgent = getParsedUA(); | ||
| 729 | console.debug('User Agent', userAgent); | ||
| 730 | const isMobileSafari = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); | ||
| 731 | const isDesktopSafari = userAgent?.browser?.name === 'Safari' && userAgent?.platform?.type === 'desktop'; | ||
| 732 | const isIOS = userAgent?.os?.name === 'iOS'; | ||
| 733 | |||
| 734 | if (isIOS || isMobileSafari || isDesktopSafari) { | ||
| 735 | document.body.classList.add('safari'); | ||
| 736 | } | ||
| 737 | |||
| 738 | $('#main_api').change(function () { | 740 | $('#main_api').change(function () { |
| 739 | var PrevAPI = main_api; | 741 | var PrevAPI = main_api; |
| 740 | setTimeout(() => RA_autoconnect(PrevAPI), 100); | 742 | setTimeout(() => RA_autoconnect(PrevAPI), 100); |