Lower amount of user requests on state changes

remove pending offline option
This commit is contained in:
Natsumi
2024-10-19 02:26:05 +13:00
parent be52f3b885
commit b5f4f0a30a
14 changed files with 20 additions and 129 deletions
+19 -63
View File
@@ -5098,7 +5098,8 @@ speechSynthesis.getVoices();
json: { json: {
location: content.location, location: content.location,
travelingToLocation: content.travelingToLocation, travelingToLocation: content.travelingToLocation,
...content.user ...content.user,
state: 'online'
}, },
params: { params: {
userId: content.userId userId: content.userId
@@ -5118,7 +5119,10 @@ speechSynthesis.getVoices();
case 'friend-active': case 'friend-active':
if (content?.user?.id) { if (content?.user?.id) {
this.$emit('USER', { this.$emit('USER', {
json: content.user, json: {
...content.user,
state: 'active'
},
params: { params: {
userId: content.userId userId: content.userId
} }
@@ -5175,7 +5179,8 @@ speechSynthesis.getVoices();
json: { json: {
location: content.location, location: content.location,
travelingToLocation: content.travelingToLocation, travelingToLocation: content.travelingToLocation,
...content.user ...content.user,
state: 'online'
}, },
params: { params: {
userId: content.userId userId: content.userId
@@ -9464,7 +9469,7 @@ speechSynthesis.getVoices();
this.sortOfflineFriends = true; this.sortOfflineFriends = true;
} }
} }
// FIXME: 도배 가능성 있음 // from getCurrentUser only, fetch user if offline in an instance
if ( if (
origin && origin &&
ctx.state !== 'online' && ctx.state !== 'online' &&
@@ -9544,21 +9549,11 @@ speechSynthesis.getVoices();
) { ) {
if (this.debugFriendState) { if (this.debugFriendState) {
console.log( console.log(
ctx.name, `falsePositiveOffline ${ctx.name} currentState:${ctx.ref.state} expectedState:${stateInput}`
new Date().toJSON(),
'falsePositiveOffline',
stateInput,
ctx.ref.state
); );
} }
return; return;
} }
var isVIP = this.localFavoriteFriends.has(id);
var newState = stateInput;
var args = await API.getUser({
userId: id
});
newState = args.ref.state;
if (this.debugFriendState) { if (this.debugFriendState) {
console.log( console.log(
ctx.name, ctx.name,
@@ -9568,7 +9563,9 @@ speechSynthesis.getVoices();
ctx.ref.state ctx.ref.state
); );
} }
var newRef = args.ref; var isVIP = this.localFavoriteFriends.has(id);
var newState = stateInput;
var ref = ctx.ref;
if (ctx.state !== newState && typeof ctx.ref !== 'undefined') { if (ctx.state !== newState && typeof ctx.ref !== 'undefined') {
if ( if (
(newState === 'offline' || newState === 'active') && (newState === 'offline' || newState === 'active') &&
@@ -9587,8 +9584,8 @@ speechSynthesis.getVoices();
var feed = { var feed = {
created_at: new Date().toJSON(), created_at: new Date().toJSON(),
type: 'Offline', type: 'Offline',
userId: newRef.id, userId: ref.id,
displayName: newRef.displayName, displayName: ref.displayName,
location, location,
worldName, worldName,
groupName, groupName,
@@ -9606,14 +9603,14 @@ speechSynthesis.getVoices();
ctx.ref.$online_for = Date.now(); ctx.ref.$online_for = Date.now();
ctx.ref.$offline_for = ''; ctx.ref.$offline_for = '';
ctx.ref.$active_for = ''; ctx.ref.$active_for = '';
var worldName = await this.getWorldName(newRef.location); var worldName = await this.getWorldName(ref.location);
var groupName = await this.getGroupName(location); var groupName = await this.getGroupName(location);
var feed = { var feed = {
created_at: new Date().toJSON(), created_at: new Date().toJSON(),
type: 'Online', type: 'Online',
userId: id, userId: id,
displayName: ctx.name, displayName: ctx.name,
location: newRef.location, location: ref.location,
worldName, worldName,
groupName, groupName,
time: '' time: ''
@@ -9655,7 +9652,7 @@ speechSynthesis.getVoices();
this.updateOnlineFriendCoutner(); this.updateOnlineFriendCoutner();
} }
ctx.state = newState; ctx.state = newState;
ctx.name = newRef.displayName; ctx.name = ref.displayName;
ctx.isVIP = isVIP; ctx.isVIP = isVIP;
}; };
@@ -10590,9 +10587,6 @@ speechSynthesis.getVoices();
ref.$previousLocation = ''; ref.$previousLocation = '';
ref.$travelingToTime = Date.now(); ref.$travelingToTime = Date.now();
} }
if (friend.state !== 'online') {
API.getUser({ userId: ref.id });
}
} }
if ( if (
props.location && props.location &&
@@ -15738,10 +15732,7 @@ speechSynthesis.getVoices();
'[ "https://avtr.just-h.party/vrcx_search.php" ]' '[ "https://avtr.just-h.party/vrcx_search.php" ]'
) )
); );
$app.data.pendingOfflineDelay = await configRepository.getInt( $app.data.pendingOfflineDelay = 110000;
'VRCX_pendingOfflineDelay',
110000
);
if (await configRepository.getString('VRCX_avatarRemoteDatabaseProvider')) { if (await configRepository.getString('VRCX_avatarRemoteDatabaseProvider')) {
// move existing provider to new list // move existing provider to new list
var avatarRemoteDatabaseProvider = await configRepository.getString( var avatarRemoteDatabaseProvider = await configRepository.getString(
@@ -29309,41 +29300,6 @@ speechSynthesis.getVoices();
} }
}; };
// #endregion
// #region | App: pending offline timer
$app.methods.promptSetPendingOffline = function () {
this.$prompt(
$t('prompt.pending_offline_delay.description'),
$t('prompt.pending_offline_delay.header'),
{
distinguishCancelAndClose: true,
confirmButtonText: $t('prompt.pending_offline_delay.save'),
cancelButtonText: $t('prompt.pending_offline_delay.cancel'),
inputValue: this.pendingOfflineDelay / 1000,
inputPattern: /\d+$/,
inputErrorMessage: $t(
'prompt.pending_offline_delay.input_error'
),
callback: async (action, instance) => {
if (
action === 'confirm' &&
instance.inputValue &&
!isNaN(instance.inputValue)
) {
this.pendingOfflineDelay = Math.trunc(
Number(instance.inputValue) * 1000
);
await configRepository.setInt(
'VRCX_pendingOfflineDelay',
this.pendingOfflineDelay
);
}
}
}
);
};
// #endregion // #endregion
// #region | App: ChatBox Blacklist // #region | App: ChatBox Blacklist
$app.data.chatboxBlacklist = [ $app.data.chatboxBlacklist = [
-5
View File
@@ -405,11 +405,6 @@
"screenshot_metadata": "Screenshot Metadata", "screenshot_metadata": "Screenshot Metadata",
"vrc_registry_backup": "VRC Registry Backup", "vrc_registry_backup": "VRC Registry Backup",
"common_folders": "Common Folders", "common_folders": "Common Folders",
"pending_offline": {
"header": "Pending Offline",
"description": "Delay before marking user as offline (fixes false positives)",
"set_delay": "Set Delay"
},
"primary_password": { "primary_password": {
"header": "Primary Password", "header": "Primary Password",
"description": "Encrypt password (disables auto login)" "description": "Encrypt password (disables auto login)"
-5
View File
@@ -405,11 +405,6 @@
"screenshot_metadata": "Metadatos de las Capturas de Pantalla", "screenshot_metadata": "Metadatos de las Capturas de Pantalla",
"vrc_registry_backup": "Copia de seguridad del registro de VRC", "vrc_registry_backup": "Copia de seguridad del registro de VRC",
"common_folders": "Carpetas Comunes", "common_folders": "Carpetas Comunes",
"pending_offline": {
"header": "Pendiente de Desconexión",
"description": "Retraso antes de marcar al usuario como desconectado (corrige los falsos positivos)",
"set_delay": "Establecer retraso"
},
"primary_password": { "primary_password": {
"header": "Contraseña Principal", "header": "Contraseña Principal",
"description": "Cifrar contraseña (deshabilita el inicio de sesión automático)" "description": "Cifrar contraseña (deshabilita el inicio de sesión automático)"
-5
View File
@@ -413,11 +413,6 @@
"screenshot_metadata": "Métadonnées d'une capture d'écran", "screenshot_metadata": "Métadonnées d'une capture d'écran",
"vrc_registry_backup": "Sauvegarde du registre VRC", "vrc_registry_backup": "Sauvegarde du registre VRC",
"common_folders": "Dossiers communs", "common_folders": "Dossiers communs",
"pending_offline": {
"header": "En attendant l'hors ligne",
"description": "Délai avant de marquer un utilisateur comme étant hors ligne (corrige les faux positifs)",
"set_delay": "Réglage du délai"
},
"primary_password": { "primary_password": {
"header": "Mot de passe principal", "header": "Mot de passe principal",
"description": "Encodage du mot de passe (désactive la connexion automatique)" "description": "Encodage du mot de passe (désactive la connexion automatique)"
-5
View File
@@ -413,11 +413,6 @@
"screenshot_metadata": "Screenshot Metadata", "screenshot_metadata": "Screenshot Metadata",
"vrc_registry_backup": "VRC Registry Backup", "vrc_registry_backup": "VRC Registry Backup",
"common_folders": "Common Folders", "common_folders": "Common Folders",
"pending_offline": {
"header": "Pending Offline",
"description": "Delay before marking user as offline (fixes false positives)",
"set_delay": "Set Delay"
},
"primary_password": { "primary_password": {
"header": "Primary Password", "header": "Primary Password",
"description": "Encrypt password (disables auto login)" "description": "Encrypt password (disables auto login)"
-5
View File
@@ -405,11 +405,6 @@
"screenshot_metadata": "スクリーンショットのメタデータ", "screenshot_metadata": "スクリーンショットのメタデータ",
"vrc_registry_backup": "VRChatのレジストリをバックアップ", "vrc_registry_backup": "VRChatのレジストリをバックアップ",
"common_folders": "共通フォルダ", "common_folders": "共通フォルダ",
"pending_offline": {
"header": "オフラインの保留",
"description": "オフラインと判定されるまでの時間 (誤検知対策)",
"set_delay": "遅延時間を設定"
},
"primary_password": { "primary_password": {
"header": "プライマリーパスワード", "header": "プライマリーパスワード",
"description": "パスワードを暗号化 (自動ログイン無効化)" "description": "パスワードを暗号化 (自動ログイン無効化)"
-5
View File
@@ -413,11 +413,6 @@
"screenshot_metadata": "스크린샷 메타데이터", "screenshot_metadata": "스크린샷 메타데이터",
"vrc_registry_backup": "VRC Registry Backup", "vrc_registry_backup": "VRC Registry Backup",
"common_folders": "Common Folders", "common_folders": "Common Folders",
"pending_offline": {
"header": "오프라인 대기",
"description": "유저의 오프라인 상태 전환을 유예합니다. (버그 해결)",
"set_delay": "대기 시간 설정"
},
"primary_password": { "primary_password": {
"header": "잠금 비밀번호", "header": "잠금 비밀번호",
"description": "비밀번호 암호화 사용 (자동 로그인 불가)" "description": "비밀번호 암호화 사용 (자동 로그인 불가)"
-5
View File
@@ -413,11 +413,6 @@
"screenshot_metadata": "Metadane zrzutu ekranu", "screenshot_metadata": "Metadane zrzutu ekranu",
"vrc_registry_backup": "Kopia zapasowa rejestru VRC", "vrc_registry_backup": "Kopia zapasowa rejestru VRC",
"common_folders": "Foldery", "common_folders": "Foldery",
"pending_offline": {
"header": "Oczekujące offline",
"description": "Odczekaj przed oznaczeniem użytkownika jako offline (unika fałszywych alarmów)",
"set_delay": "Ustaw opóźnienie"
},
"primary_password": { "primary_password": {
"header": "Hasło główne", "header": "Hasło główne",
"description": "Szyfruj hasło (wyłącza automatyczne logowanie)" "description": "Szyfruj hasło (wyłącza automatyczne logowanie)"
-5
View File
@@ -413,11 +413,6 @@
"screenshot_metadata": "Screenshot Metadata", "screenshot_metadata": "Screenshot Metadata",
"vrc_registry_backup": "Backup do Registro VRC", "vrc_registry_backup": "Backup do Registro VRC",
"common_folders": "Pastas Comuns", "common_folders": "Pastas Comuns",
"pending_offline": {
"header": "Pendências Offline",
"description": "Atraso antes de marcar o usuário como offline (corrige falsos positivos)",
"set_delay": "Definir Atraso"
},
"primary_password": { "primary_password": {
"header": "Senha Primaria", "header": "Senha Primaria",
"description": "Criptografar senha (desativa o login automático)" "description": "Criptografar senha (desativa o login automático)"
-5
View File
@@ -405,11 +405,6 @@
"screenshot_metadata": "Метаданные скриншота", "screenshot_metadata": "Метаданные скриншота",
"vrc_registry_backup": "Резервное копирование реестра VRC", "vrc_registry_backup": "Резервное копирование реестра VRC",
"common_folders": "Общие папки", "common_folders": "Общие папки",
"pending_offline": {
"header": "Ожидание отключения",
"description": "Задержка перед отметкой пользователя как офлайн (исправляет ложные срабатывания)",
"set_delay": "Установить задержку"
},
"primary_password": { "primary_password": {
"header": "Основной пароль", "header": "Основной пароль",
"description": "Шифровать пароль (отключает автоматический вход)" "description": "Шифровать пароль (отключает автоматический вход)"
-5
View File
@@ -413,11 +413,6 @@
"screenshot_metadata": "Screenshot Metadata", "screenshot_metadata": "Screenshot Metadata",
"vrc_registry_backup": "VRC Registry Backup", "vrc_registry_backup": "VRC Registry Backup",
"common_folders": "Thư mục chung", "common_folders": "Thư mục chung",
"pending_offline": {
"header": "Đang chờ Offline",
"description": "Trì trệ trước khi đánh dấu người chơi đang offline (sửa lỗi hiển thị sai)",
"set_delay": "Đặt trì trệ"
},
"primary_password": { "primary_password": {
"header": "Mật khẩu chính", "header": "Mật khẩu chính",
"description": "Mã hóa mật khẩu (sẽ tắt đăng nhập tự động)" "description": "Mã hóa mật khẩu (sẽ tắt đăng nhập tự động)"
-5
View File
@@ -405,11 +405,6 @@
"screenshot_metadata": "截图元数据查看器", "screenshot_metadata": "截图元数据查看器",
"vrc_registry_backup": "VRC 设置数据备份工具", "vrc_registry_backup": "VRC 设置数据备份工具",
"common_folders": "常用文件夹", "common_folders": "常用文件夹",
"pending_offline": {
"header": "离线标记延迟",
"description": "将好友标记为离线之前的延迟(防止误判)",
"set_delay": "设置延迟"
},
"primary_password": { "primary_password": {
"header": "独立密码", "header": "独立密码",
"description": "使用独立密码加密 VRCX 数据(将停用自动登录)" "description": "使用独立密码加密 VRCX 数据(将停用自动登录)"
-5
View File
@@ -413,11 +413,6 @@
"screenshot_metadata": "螢幕截圖詳細資訊", "screenshot_metadata": "螢幕截圖詳細資訊",
"vrc_registry_backup": "VRC Registry Backup", "vrc_registry_backup": "VRC Registry Backup",
"common_folders": "遊戲資料夾", "common_folders": "遊戲資料夾",
"pending_offline": {
"header": "待確認離線",
"description": "將玩家標記為離線之前延遲(防止誤判)",
"set_delay": "設定延遲"
},
"primary_password": { "primary_password": {
"header": "主密碼", "header": "主密碼",
"description": "密碼加密(將停用自動登入)" "description": "密碼加密(將停用自動登入)"
-5
View File
@@ -563,11 +563,6 @@ mixin settingsTab()
div.options-container div.options-container
span.header {{ $t('view.settings.advanced.advanced.cache_debug.header') }} span.header {{ $t('view.settings.advanced.advanced.cache_debug.header') }}
br br
span.sub-header {{ $t('view.settings.advanced.advanced.pending_offline.header') }}
div.options-container-item
span.name {{ $t('view.settings.advanced.advanced.pending_offline.description') }}
el-button-group(style="display:block")
el-button(size="small" icon="el-icon-s-operation" @click="promptSetPendingOffline") {{ $t('view.settings.advanced.advanced.pending_offline.set_delay') }}
+simpleSwitch("view.settings.advanced.advanced.cache_debug.udon_exception_logging", "udonExceptionLogging", "saveOpenVROption") +simpleSwitch("view.settings.advanced.advanced.cache_debug.udon_exception_logging", "udonExceptionLogging", "saveOpenVROption")
div.options-container-item div.options-container-item
span.name {{ $t('view.settings.advanced.advanced.cache_debug.disable_gamelog') }} span.name {{ $t('view.settings.advanced.advanced.cache_debug.disable_gamelog') }}