[mirotalk] - feat: persist avatar URL across sessions via P2P_SETTINGS localStorage
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
# ====================================================
|
||||
# MiroTalk P2P v.1.8.18 - Environment Configuration
|
||||
# MiroTalk P2P v.1.8.19 - Environment Configuration
|
||||
# ====================================================
|
||||
|
||||
# App environment
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* ==============================================
|
||||
* MiroTalk P2P v.1.8.18 - Configuration File
|
||||
* MiroTalk P2P v.1.8.19 - Configuration File
|
||||
* ==============================================
|
||||
*
|
||||
* This file is the central configuration source.
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ dependencies: {
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.8.18
|
||||
* @version 1.8.19
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.8.17",
|
||||
"version": "1.8.19",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mirotalk",
|
||||
"version": "1.8.17",
|
||||
"version": "1.8.19",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"@mattermost/client": "11.6.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.8.18",
|
||||
"version": "1.8.19",
|
||||
"description": "A free WebRTC browser-based video call",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ let brand = {
|
||||
},
|
||||
about: {
|
||||
imageUrl: '../images/mirotalk-logo.gif',
|
||||
title: 'WebRTC P2P v1.8.18',
|
||||
title: 'WebRTC P2P v1.8.19',
|
||||
html: `
|
||||
<button
|
||||
id="support-button"
|
||||
|
||||
+14
-5
@@ -15,7 +15,7 @@
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.8.18
|
||||
* @version 1.8.19
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -582,7 +582,7 @@ let thisMaxRoomParticipants = 8;
|
||||
let swBg = 'rgba(0, 0, 0, 0.7)'; // swAlert background color
|
||||
let isDocumentOnFullScreen = false;
|
||||
let isToggleExtraBtnClicked = false;
|
||||
let hasTemporaryAvatar = false;
|
||||
let hasTemporaryAvatar = !!(lsSettings.peer_avatar && isValidAvatarURL(lsSettings.peer_avatar));
|
||||
|
||||
// peer
|
||||
let myPeerId; // This socket.id
|
||||
@@ -1289,6 +1289,11 @@ function getPeerAvatar() {
|
||||
console.log('Direct join', { avatar: avatar });
|
||||
|
||||
if (avatarDisabled || isBase64Avatar || !isValidAvatarURL(avatar)) {
|
||||
const saved = lsSettings.peer_avatar;
|
||||
if (saved && isValidAvatarURL(saved)) {
|
||||
console.log('Restored avatar from localStorage', { avatar: saved });
|
||||
return saved;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return avatar;
|
||||
@@ -12305,6 +12310,8 @@ async function updateMyPeerAvatarByUrl() {
|
||||
try {
|
||||
myPeerAvatar = result.value;
|
||||
hasTemporaryAvatar = true;
|
||||
lsSettings.peer_avatar = myPeerAvatar;
|
||||
lS.setSettings(lsSettings);
|
||||
|
||||
setPeerAvatarImgName('myVideoAvatarImage', myPeerName, myPeerAvatar);
|
||||
setPeerAvatarImgName('myProfileAvatar', myPeerName, myPeerAvatar);
|
||||
@@ -12313,7 +12320,7 @@ async function updateMyPeerAvatarByUrl() {
|
||||
|
||||
emitMyPeerProfile();
|
||||
|
||||
userLog('toast', 'Temporary avatar applied (will reset on refresh)');
|
||||
userLog('toast', 'Avatar saved and will persist across sessions');
|
||||
} catch (err) {
|
||||
console.error('Failed to set avatar URL', err);
|
||||
userLog('error', 'Unable to apply avatar URL');
|
||||
@@ -12326,6 +12333,8 @@ async function updateMyPeerAvatarByUrl() {
|
||||
function resetMyPeerAvatarInMemory() {
|
||||
myPeerAvatar = false;
|
||||
hasTemporaryAvatar = false;
|
||||
lsSettings.peer_avatar = '';
|
||||
lS.setSettings(lsSettings);
|
||||
setPeerAvatarImgName('myVideoAvatarImage', myPeerName, myPeerAvatar);
|
||||
setPeerAvatarImgName('myProfileAvatar', myPeerName, myPeerAvatar);
|
||||
setPeerChatAvatarImgName('right', myPeerName, myPeerAvatar);
|
||||
@@ -12333,7 +12342,7 @@ function resetMyPeerAvatarInMemory() {
|
||||
|
||||
emitMyPeerProfile();
|
||||
|
||||
userLog('toast', 'Temporary avatar reset');
|
||||
userLog('toast', 'Avatar reset and removed from storage');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15549,7 +15558,7 @@ function showAbout() {
|
||||
Swal.fire({
|
||||
background: swBg,
|
||||
position: 'center',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.18',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.19',
|
||||
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
|
||||
customClass: { image: 'img-about' },
|
||||
html: `
|
||||
|
||||
@@ -33,6 +33,7 @@ class LocalStorage {
|
||||
theme_custom: false, // keep custom theme
|
||||
buttons_bar: 0, // vertical
|
||||
pin_grid: 0, // vertical
|
||||
peer_avatar: '', // persisted avatar URL
|
||||
};
|
||||
|
||||
this.DEVICES_COUNT = {
|
||||
|
||||
@@ -1067,7 +1067,7 @@ access to use this app.
|
||||
</div>
|
||||
<div>
|
||||
<button id="myProfileAvatarUploadBtn">
|
||||
<i class="fas fa-image"></i> Set avatar URL
|
||||
<i class="fas fa-image"></i> Set avatar
|
||||
</button>
|
||||
<button id="myProfileAvatarResetBtn" class="hidden">
|
||||
<i class="fas fa-rotate-left"></i> Reset avatar
|
||||
|
||||
Reference in New Issue
Block a user