add export friends list (closes #80)

This commit is contained in:
pypy
2020-09-29 20:27:58 +09:00
parent 68c04f7a09
commit 4a35062c6a
2 changed files with 32 additions and 3 deletions

View File

@@ -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();
});

View File

@@ -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")