diff --git a/html/src/app.js b/html/src/app.js
index 0604f325..41fbd73b 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -3274,7 +3274,9 @@ CefSharp.BindObjectAsync(
isGameRunning: false,
appVersion: 'VRCX 2020.07.13',
latestAppVersion: '',
- ossDialog: false
+ ossDialog: false,
+ exportFriendsListDialog: false,
+ exportFriendsListContent: ''
},
computed: {},
methods: {},
@@ -3528,6 +3530,29 @@ CefSharp.BindObjectAsync(
});
};
+ $app.methods.showExportFriendsListDialog = function () {
+ var { friends } = API.currentUser;
+ if (Array.isArray(friends) === false) {
+ return;
+ }
+ var lines = [
+ 'UserID,DisplayName'
+ ];
+ var _ = function (str) {
+ if (/[\x00-\x1f,"]/.test(str) === true) {
+ str = `"${str.replace('"', '""')}"`;
+ }
+ return str;
+ };
+ for (var userId of friends) {
+ var ref = this.friends.get(userId);
+ var name = (ref !== undefined && ref.name) || '';
+ lines.push(`${_(userId)},${_(name)}`);
+ }
+ this.exportFriendsListContent = lines.join('\n');
+ this.exportFriendsListDialog = true;
+ };
+
API.$on('USER:2FA', function () {
$app.promptTOTP();
});
diff --git a/html/src/index.pug b/html/src/index.pug
index a83223e8..65b7bd31 100644
--- a/html/src/index.pug
+++ b/html/src/index.pug
@@ -428,8 +428,8 @@ html
span.name Two-Factor Auth (2FA)
span.extra {{ API.currentUser.twoFactorAuthEnabled ? 'Enabled' : 'Disabled' }}
div(style="margin-top:10px")
- el-button-group
- el-button(size="small" icon="el-icon-switch-button" @click="logout()") Logout
+ 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
div(style="margin-top:30px")
span(style="font-weight:bold") Past Display Names
data-tables(v-bind="pastDisplayNameTable" style="margin-top:5px")
@@ -1049,6 +1049,10 @@ html
el-button(size="small" @click="showInviteDialog(launchDialog.location)") Invite
el-button(type="primary" size="small" @click="launchGame(locationToLaunchArg(launchDialog.location))") Launch
+ //- dialog: export friends list
+ 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: open source software notice
el-dialog.x-dialog(:visible.sync="ossDialog" title="Open Source Software Notice" width="650px")
div(style="height:350px;overflow:hidden scroll;word-break:break-all")