diff --git a/html/src/app.js b/html/src/app.js
index 6223b2ce..93e45555 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -4647,6 +4647,59 @@ speechSynthesis.getVoices();
this.exportFriendsListDialog = true;
};
+ $app.data.exportAvatarsListDialog = false;
+ $app.data.exportAvatarsListContent = '';
+
+ $app.methods.showExportAvatarsListDialog = function () {
+ for (var ref of API.cachedAvatars.values()) {
+ if (ref.authorId === API.currentUser.id) {
+ API.cachedAvatars.delete(ref.id);
+ }
+ }
+ var params = {
+ n: 50,
+ offset: 0,
+ sort: 'updated',
+ order: 'descending',
+ releaseStatus: 'all',
+ user: 'me',
+ };
+ var map = new Map();
+ API.bulk({
+ fn: 'getAvatars',
+ N: -1,
+ params,
+ handle: (args) => {
+ for (var json of args.json) {
+ var $ref = API.cachedAvatars.get(json.id);
+ if (typeof $ref !== 'undefined') {
+ map.set($ref.id, $ref);
+ }
+ }
+ },
+ done: () => {
+ var avatars = Array.from(map.values());
+ if (Array.isArray(avatars) === false) {
+ return;
+ }
+ var lines = [
+ 'AvatarID,AvatarName'
+ ];
+ var _ = function (str) {
+ if (/[\x00-\x1f,"]/.test(str) === true) {
+ str = `"${str.replace(/"/g, '""')}"`;
+ }
+ return str;
+ };
+ for (var avatar of avatars) {
+ lines.push(`${_(avatar.id)},${_(avatar.name)}`);
+ }
+ this.exportAvatarsListContent = lines.join('\n');
+ this.exportAvatarsListDialog = true;
+ }
+ });
+ };
+
API.$on('USER:2FA', function () {
$app.promptTOTP();
});
diff --git a/html/src/index.pug b/html/src/index.pug
index 520bd1f8..5d02a53f 100644
--- a/html/src/index.pug
+++ b/html/src/index.pug
@@ -481,6 +481,7 @@ html
div(style="margin-top:10px")
el-button(size="small" icon="el-icon-switch-button" @click="logout()") Logout
el-button(size="small" icon="el-icon-printer" @click="showExportFriendsListDialog()") Export Friends List
+ el-button(size="small" icon="el-icon-user" @click="showExportAvatarsListDialog()") Export Own Avatars
el-button(size="small" icon="el-icon-chat-dot-round" @click="showDiscordNamesDialog()") Discord Names
div.options-container
span.header Game Info
@@ -1581,6 +1582,10 @@ html
el-dialog.x-dialog(:visible.sync="exportFriendsListDialog" title="Export Friends List" width="650px")
el-input(type="textarea" v-model="exportFriendsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
+ //- dialog: export avatars list
+ el-dialog.x-dialog(:visible.sync="exportAvatarsListDialog" title="Export Own Avatars" width="650px")
+ el-input(type="textarea" v-model="exportAvatarsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
+
//- dialog: Discord username list
el-dialog.x-dialog(:visible.sync="discordNamesDialogVisible" title="Discord Names" width="650px")
div(style='font-size:12px;')