refactor: app.js (#1291)

* refactor: frontend

* Fix avatar gallery sort

* Update .NET dependencies

* Update npm dependencies

electron v37.1.0

* bulkRefreshFriends

* fix dark theme

* Remove crowdin

* Fix config.json dialog not updating

* VRCX log file fixes & add Cef log

* Remove SharedVariable, fix startup

* Revert init theme change

* Logging date not working? Fix WinformThemer designer error

* Add Cef request hander, no more escaping main page

* clean

* fix

* fix

* clean

* uh

* Apply thememode at startup, fixes random user colours

* Split database into files

* Instance info remove empty lines

* Open external VRC links with VRCX

* Electron fixes

* fix userdialog style

* ohhhh

* fix store

* fix store

* fix: load all group members after kicking a user

* fix: world dialog favorite button style

* fix: Clear VRCX Cache Timer input value

* clean

* Fix VR overlay

* Fix VR overlay 2

* Fix Discord discord rich presence for RPC worlds

* Clean up age verified user tags

* Fix playerList being occupied after program reload

* no `this`

* Fix login stuck loading

* writable: false

* Hide dialogs on logout

* add flush sync option

* rm LOGIN event

* rm LOGOUT event

* remove duplicate event listeners

* remove duplicate event listeners

* clean

* remove duplicate event listeners

* clean

* fix theme style

* fix t

* clearable

* clean

* fix ipcEvent

* Small changes

* Popcorn Palace support

* Remove checkActiveFriends

* Clean up

* Fix dragEnterCef

* Block API requests when not logged in

* Clear state on login & logout

* Fix worldDialog instances not updating

* use <script setup>

* Fix avatar change event, CheckGameRunning at startup

* Fix image dragging

* fix

* Remove PWI

* fix updateLoop

* add webpack-dev-server to dev environment

* rm unnecessary chunks

* use <script setup>

* webpack-dev-server changes

* use <script setup>

* use <script setup>

* Fix UGC text size

* Split login event

* t

* use <script setup>

* fix

* Update .gitignore and enable checkJs in jsconfig

* fix i18n t

* use <script setup>

* use <script setup>

* clean

* global types

* fix

* use checkJs for debugging

* Add watchState for login watchers

* fix .vue template

* type fixes

* rm Vue.filter

* Cef v138.0.170, VC++ 2022

* Settings fixes

* Remove 'USER:CURRENT'

* clean up 2FA callbacks

* remove userApply

* rm i18n import

* notification handling to use notification store methods

* refactor favorite handling to use favorite store methods and clean up event emissions

* refactor moderation handling to use dedicated functions for player moderation events

* refactor friend handling to use dedicated functions for friend events

* Fix program startup, move lang init

* Fix friend state

* Fix status change error

* Fix user notes diff

* fix

* rm group event

* rm auth event

* rm avatar event

* clean

* clean

* getUser

* getFriends

* getFavoriteWorlds, getFavoriteAvatars

* AvatarGalleryUpload btn style & package.json update

* Fix friend requests

* Apply user

* Apply world

* Fix note diff

* Fix VR overlay

* Fixes

* Update build scripts

* Apply avatar

* Apply instance

* Apply group

* update hidden VRC+ badge

* Fix sameInstance "private"

* fix 502/504 API errors

* fix 502/504 API errors

* clean

* Fix friend in same instance on orange showing twice in friends list

* Add back in broken friend state repair methods

* add types

---------

Co-authored-by: Natsumi <cmcooper123@hotmail.com>
This commit is contained in:
pa
2025-07-14 12:00:08 +09:00
committed by GitHub
parent 952fd77ed5
commit f4f78bb5ec
323 changed files with 47745 additions and 43326 deletions
+151 -145
View File
@@ -1,5 +1,5 @@
<template>
<safe-dialog :visible.sync="isDialogVisible" :title="$t('dialog.world_export.header')" width="650px">
<safe-dialog :visible.sync="isDialogVisible" :title="t('dialog.world_export.header')" width="650px">
<el-checkbox-group
v-model="exportSelectedOptions"
style="margin-bottom: 10px"
@@ -26,7 +26,7 @@
<el-dropdown-item style="display: block; margin: 10px 0" @click.native="selectWorldExportGroup(null)">
None
</el-dropdown-item>
<template v-for="groupAPI in API.favoriteWorldGroups">
<template v-for="groupAPI in favoriteWorldGroups">
<el-dropdown-item
:key="groupAPI.name"
style="display: block; margin: 10px 0"
@@ -81,151 +81,157 @@
</safe-dialog>
</template>
<script>
export default {
name: 'WorldExportDialog',
inject: ['API'],
props: {
favoriteWorlds: Array,
worldExportDialogVisible: Boolean,
localWorldFavorites: Object,
localWorldFavoriteGroups: Array,
localWorldFavoritesList: Array
<script setup>
import { ref, computed, watch, getCurrentInstance } from 'vue';
import { useI18n } from 'vue-i18n-bridge';
import { storeToRefs } from 'pinia';
import { useFavoriteStore, useWorldStore } from '../../../stores';
const props = defineProps({
worldExportDialogVisible: {
type: Boolean,
required: true
}
});
const emit = defineEmits(['update:WorldExportDialogVisible']);
const { t } = useI18n();
const { proxy } = getCurrentInstance();
const favoriteStore = useFavoriteStore();
const {
favoriteWorlds,
favoriteWorldGroups,
localWorldFavorites,
localWorldFavoriteGroups,
localWorldFavoritesList
} = storeToRefs(favoriteStore);
const { getLocalWorldFavoriteGroupLength } = favoriteStore;
const { cachedWorlds } = storeToRefs(useWorldStore());
const worldExportContent = ref('');
const worldExportFavoriteGroup = ref(null);
const worldExportLocalFavoriteGroup = ref(null);
// Storage of selected filtering options for model and world export
const exportSelectedOptions = ref(['ID', 'Name']);
const exportSelectOptions = ref([
{ label: 'ID', value: 'id' },
{ label: 'Name', value: 'name' },
{ label: 'Author ID', value: 'authorId' },
{ label: 'Author Name', value: 'authorName' },
{ label: 'Thumbnail', value: 'thumbnailImageUrl' }
]);
const isDialogVisible = computed({
get() {
return props.worldExportDialogVisible;
},
data() {
return {
worldExportContent: '',
worldExportFavoriteGroup: null,
worldExportLocalFavoriteGroup: null,
// Storage of selected filtering options for model and world export
exportSelectedOptions: ['ID', 'Name'],
exportSelectOptions: [
{ label: 'ID', value: 'id' },
{ label: 'Name', value: 'name' },
{ label: 'Author ID', value: 'authorId' },
{ label: 'Author Name', value: 'authorName' },
{ label: 'Thumbnail', value: 'thumbnailImageUrl' }
]
};
},
computed: {
isDialogVisible: {
get() {
return this.worldExportDialogVisible;
},
set(value) {
this.$emit('update:world-export-dialog-visible', value);
}
}
},
watch: {
worldExportDialogVisible(value) {
if (value) {
this.showWorldExportDialog();
}
}
},
methods: {
showWorldExportDialog() {
this.worldExportFavoriteGroup = null;
this.worldExportLocalFavoriteGroup = null;
this.updateWorldExportDialog();
},
set(value) {
emit('update:WorldExportDialogVisible', value);
}
});
handleCopyWorldExportData(event) {
if (event.target.tagName === 'TEXTAREA') {
event.target.select();
}
navigator.clipboard
.writeText(this.worldExportContent)
.then(() => {
this.$message({
message: 'Copied successfully!',
type: 'success',
duration: 2000
});
})
.catch((err) => {
console.error('Copy failed:', err);
this.$message.error('Copy failed!');
});
},
updateWorldExportDialog() {
const formatter = function (str) {
if (/[\x00-\x1f,"]/.test(str) === true) {
return `"${str.replace(/"/g, '""')}"`;
}
return str;
};
const propsForQuery = this.exportSelectOptions
.filter((option) => this.exportSelectedOptions.includes(option.label))
.map((option) => option.value);
function resText(ref) {
let resArr = [];
propsForQuery.forEach((e) => {
resArr.push(formatter(ref?.[e]));
});
return resArr.join(',');
}
const lines = [this.exportSelectedOptions.join(',')];
if (this.worldExportFavoriteGroup) {
this.API.favoriteWorldGroups.forEach((group) => {
if (this.worldExportFavoriteGroup === group) {
this.favoriteWorlds.forEach((ref) => {
if (group.key === ref.groupKey) {
lines.push(resText(ref.ref));
}
});
}
});
} else if (this.worldExportLocalFavoriteGroup) {
const favoriteGroup = this.localWorldFavorites[this.worldExportLocalFavoriteGroup];
if (!favoriteGroup) {
return;
}
for (let i = 0; i < favoriteGroup.length; ++i) {
const ref = favoriteGroup[i];
lines.push(resText(ref));
}
} else {
// export all
this.favoriteWorlds.forEach((ref) => {
lines.push(resText(ref.ref));
});
for (let i = 0; i < this.localWorldFavoritesList.length; ++i) {
const worldId = this.localWorldFavoritesList[i];
const ref = this.API.cachedWorlds.get(worldId);
if (typeof ref !== 'undefined') {
lines.push(resText(ref));
}
}
}
this.worldExportContent = lines.join('\n');
},
selectWorldExportGroup(group) {
this.worldExportFavoriteGroup = group;
this.worldExportLocalFavoriteGroup = null;
this.updateWorldExportDialog();
},
selectWorldExportLocalGroup(group) {
this.worldExportLocalFavoriteGroup = group;
this.worldExportFavoriteGroup = null;
this.updateWorldExportDialog();
},
getLocalWorldFavoriteGroupLength(group) {
const favoriteGroup = this.localWorldFavorites[group];
if (!favoriteGroup) {
return 0;
}
return favoriteGroup.length;
watch(
() => props.worldExportDialogVisible,
(value) => {
if (value) {
showWorldExportDialog();
}
}
};
);
function showWorldExportDialog() {
worldExportFavoriteGroup.value = null;
worldExportLocalFavoriteGroup.value = null;
updateWorldExportDialog();
}
function handleCopyWorldExportData(event) {
if (event.target.tagName === 'TEXTAREA') {
event.target.select();
}
navigator.clipboard
.writeText(worldExportContent.value)
.then(() => {
proxy.$message({
message: 'Copied successfully!',
type: 'success',
duration: 2000
});
})
.catch((err) => {
console.error('Copy failed:', err);
proxy.$message.error('Copy failed!');
});
}
function updateWorldExportDialog() {
const formatter = function (str) {
if (/[\x00-\x1f,"]/.test(str) === true) {
return `"${str.replace(/"/g, '""')}"`;
}
return str;
};
const propsForQuery = exportSelectOptions.value
.filter((option) => exportSelectedOptions.value.includes(option.label))
.map((option) => option.value);
function resText(ref) {
let resArr = [];
propsForQuery.forEach((e) => {
resArr.push(formatter(ref?.[e]));
});
return resArr.join(',');
}
const lines = [exportSelectedOptions.value.join(',')];
if (worldExportFavoriteGroup.value) {
favoriteWorldGroups.value.forEach((group) => {
if (worldExportFavoriteGroup.value === group) {
favoriteWorlds.value.forEach((ref) => {
if (group.key === ref.groupKey) {
lines.push(resText(ref.ref));
}
});
}
});
} else if (worldExportLocalFavoriteGroup.value) {
const favoriteGroup = localWorldFavorites.value[worldExportLocalFavoriteGroup.value];
if (!favoriteGroup) {
return;
}
for (let i = 0; i < favoriteGroup.length; ++i) {
const ref = favoriteGroup[i];
lines.push(resText(ref));
}
} else {
// export all
favoriteWorlds.value.forEach((ref) => {
lines.push(resText(ref.ref));
});
for (let i = 0; i < localWorldFavoritesList.value.length; ++i) {
const worldId = localWorldFavoritesList.value[i];
const ref = cachedWorlds.value.get(worldId);
if (typeof ref !== 'undefined') {
lines.push(resText(ref));
}
}
}
worldExportContent.value = lines.join('\n');
}
function selectWorldExportGroup(group) {
worldExportFavoriteGroup.value = group;
worldExportLocalFavoriteGroup.value = null;
updateWorldExportDialog();
}
function selectWorldExportLocalGroup(group) {
worldExportLocalFavoriteGroup.value = group;
worldExportFavoriteGroup.value = null;
updateWorldExportDialog();
}
</script>