fix: lint

This commit is contained in:
pypy
2021-08-13 02:59:40 +09:00
parent 8efd7f0378
commit 6b1317ff8f
12 changed files with 3221 additions and 2134 deletions
+6 -5
View File
@@ -44,7 +44,8 @@ button {
border: #333; border: #333;
} }
.el-input-group__append, .el-input-group__prepend { .el-input-group__append,
.el-input-group__prepend {
color: #fff; color: #fff;
background-color: #666; background-color: #666;
border: #555; border: #555;
@@ -157,11 +158,11 @@ button {
background-color: #444; background-color: #444;
} }
.el-popper[x-placement^="bottom"] .popper__arrow::after { .el-popper[x-placement^='bottom'] .popper__arrow::after {
border-bottom-color: #333; border-bottom-color: #333;
} }
.el-popper[x-placement^="bottom"] .popper__arrow { .el-popper[x-placement^='bottom'] .popper__arrow {
border-bottom-color: #404040; border-bottom-color: #404040;
} }
@@ -230,11 +231,11 @@ button {
border-color: #5f5f5f; border-color: #5f5f5f;
} }
.el-popper[x-placement^="right"] .popper__arrow::after { .el-popper[x-placement^='right'] .popper__arrow::after {
border-right-color: #5f5f5f; border-right-color: #5f5f5f;
} }
.el-popper[x-placement^="right"] .popper__arrow { .el-popper[x-placement^='right'] .popper__arrow {
border-right-color: #5f5f5f; border-right-color: #5f5f5f;
} }
+2942 -1887
View File
File diff suppressed because it is too large Load Diff
+12 -10
View File
@@ -8,11 +8,12 @@
// For a copy, see <https://opensource.org/licenses/MIT>. // For a copy, see <https://opensource.org/licenses/MIT>.
// //
@import "~normalize.css/normalize.css"; @import '~normalize.css/normalize.css';
@import "~animate.css/animate.min.css"; @import '~animate.css/animate.min.css';
@import "~noty/lib/noty.css"; @import '~noty/lib/noty.css';
@import "~element-ui/lib/theme-chalk/index.css"; @import '~element-ui/lib/theme-chalk/index.css';
@import "~famfamfam-flags/dist/sprite/famfamfam-flags.min.css"; @import '~famfamfam-flags/dist/sprite/famfamfam-flags.min.css';
@import '~vue-swatches/dist/vue-swatches.css';
.color-palettes { .color-palettes {
background: #409eff; background: #409eff;
@@ -113,7 +114,8 @@ input,
textarea, textarea,
select, select,
button { button {
font-family: "Noto Sans JP", "Noto Sans KR", "Meiryo UI", "Malgun Gothic", "Segoe UI", sans-serif; font-family: 'Noto Sans JP', 'Noto Sans KR', 'Meiryo UI', 'Malgun Gothic',
'Segoe UI', sans-serif;
line-height: normal; line-height: normal;
} }
@@ -179,7 +181,7 @@ a {
left: 1px; left: 1px;
width: 2px; width: 2px;
height: 48px; height: 48px;
content: ""; content: '';
background: #dcdfe6; background: #dcdfe6;
} }
@@ -189,7 +191,7 @@ a {
right: 4px; right: 4px;
width: 4px; width: 4px;
height: 4px; height: 4px;
content: ""; content: '';
background: #ebeef5; background: #ebeef5;
border-radius: 50%; border-radius: 50%;
} }
@@ -317,7 +319,7 @@ img.friends-list-avatar {
bottom: 0; bottom: 0;
width: 8px; width: 8px;
height: 8px; height: 8px;
content: ""; content: '';
background: #909399; background: #909399;
border: 2px solid #fff; border: 2px solid #fff;
border-radius: 50%; border-radius: 50%;
@@ -497,7 +499,7 @@ i.x-user-status.busy {
margin-right: -85px; margin-right: -85px;
} }
.el-progress__text{ .el-progress__text {
color: #c8c8c8; color: #c8c8c8;
} }
+11 -14
View File
@@ -1,5 +1,5 @@
import sqliteService from '../service/sqlite.js'; import sqliteService from '../service/sqlite.js';
import sharedRepository, { SharedRepository } from './shared.js'; import sharedRepository, {SharedRepository} from './shared.js';
var dirtyKeySet = new Set(); var dirtyKeySet = new Set();
@@ -55,28 +55,25 @@ class ConfigRepository extends SharedRepository {
} }
remove(key) { remove(key) {
key = transformKey(key); var _key = transformKey(key);
sharedRepository.remove(key); sharedRepository.remove(_key);
dirtyKeySet.add(key); dirtyKeySet.add(_key);
} }
getString(key, defaultValue = null) { getString(key, defaultValue = null) {
key = transformKey(key); var _key = transformKey(key);
return sharedRepository.getString(key, defaultValue); return sharedRepository.getString(_key, defaultValue);
} }
setString(key, value) { setString(key, value) {
key = transformKey(key); var _key = transformKey(key);
value = String(value); var _value = String(value);
sharedRepository.setString(key, value); sharedRepository.setString(_key, _value);
dirtyKeySet.add(key); dirtyKeySet.add(_key);
} }
} }
var self = new ConfigRepository(); var self = new ConfigRepository();
window.configRepository = self; window.configRepository = self;
export { export {self as default, ConfigRepository};
self as default,
ConfigRepository
};
+23 -15
View File
@@ -29,7 +29,7 @@ class Database {
async getFeedDatabase() { async getFeedDatabase() {
var feedDatabase = []; var feedDatabase = [];
var date = new Date(); var date = new Date();
date.setDate(date.getDate() - 3); // 3 day limit date.setDate(date.getDate() - 3); // 3 day limit
var dateOffset = date.toJSON(); var dateOffset = date.toJSON();
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
@@ -113,7 +113,7 @@ class Database {
async getMemo(userId) { async getMemo(userId) {
var row = {}; var row = {};
await sqliteService.execute((dbRow, userId) => { await sqliteService.execute((dbRow) => {
row = { row = {
userId: dbRow[0], userId: dbRow[0],
editedAt: dbRow[1], editedAt: dbRow[1],
@@ -177,7 +177,7 @@ class Database {
var field = {}; var field = {};
for (var item of items) { for (var item of items) {
if (typeof line[item] === 'string') { if (typeof line[item] === 'string') {
field[item] = line[item].replace(/'/g, "\''"); field[item] = line[item].replace(/'/g, "''");
} else { } else {
field[item] = ''; field[item] = '';
} }
@@ -240,15 +240,23 @@ class Database {
return; return;
} }
var sqlValues = ''; var sqlValues = '';
var items = ['created_at', 'type', 'userId', 'displayName', 'previousDisplayName', 'trustLevel', 'previousTrustLevel']; var items = [
'created_at',
'type',
'userId',
'displayName',
'previousDisplayName',
'trustLevel',
'previousTrustLevel'
];
for (var i = 0; i < inputData.length; ++i) { for (var i = 0; i < inputData.length; ++i) {
var line = inputData[i]; var line = inputData[i];
sqlValues += '('; sqlValues += '(';
for (var k = 0; k < items.length; ++k) { for (var k = 0; k < items.length; ++k) {
var item = items[k]; var item = items[k];
var field = ''; var field = '';
if (typeof line[item] === 'string') { if (typeof line[item] === 'string') {
field = `'${line[item].replace(/'/g, "\''")}'`; field = `'${line[item].replace(/'/g, "''")}'`;
} else { } else {
field = null; field = null;
} }
@@ -257,11 +265,11 @@ class Database {
sqlValues += ', '; sqlValues += ', ';
} }
} }
sqlValues += ')'; sqlValues += ')';
if (i < inputData.length - 1) { if (i < inputData.length - 1) {
sqlValues += ', '; sqlValues += ', ';
} }
//sqlValues `('${line.created_at}', '${line.type}', '${line.userId}', '${line.displayName}', '${line.previousDisplayName}', '${line.trustLevel}', '${line.previousTrustLevel}'), ` // sqlValues `('${line.created_at}', '${line.type}', '${line.userId}', '${line.displayName}', '${line.previousDisplayName}', '${line.trustLevel}', '${line.previousTrustLevel}'), `
} }
sqliteService.executeNonQuery( sqliteService.executeNonQuery(
`INSERT OR IGNORE INTO ${Database.userId}_friend_log_history (created_at, type, user_id, display_name, previous_display_name, trust_level, previous_trust_level) VALUES ${sqlValues}` `INSERT OR IGNORE INTO ${Database.userId}_friend_log_history (created_at, type, user_id, display_name, previous_display_name, trust_level, previous_trust_level) VALUES ${sqlValues}`
@@ -317,9 +325,12 @@ class Database {
'@owner_id': entry.ownerId, '@owner_id': entry.ownerId,
'@avatar_name': entry.avatarName, '@avatar_name': entry.avatarName,
'@current_avatar_image_url': entry.currentAvatarImageUrl, '@current_avatar_image_url': entry.currentAvatarImageUrl,
'@current_avatar_thumbnail_image_url': entry.currentAvatarThumbnailImageUrl, '@current_avatar_thumbnail_image_url':
'@previous_current_avatar_image_url': entry.previousCurrentAvatarImageUrl, entry.currentAvatarThumbnailImageUrl,
'@previous_current_avatar_thumbnail_image_url': entry.previousCurrentAvatarThumbnailImageUrl '@previous_current_avatar_image_url':
entry.previousCurrentAvatarImageUrl,
'@previous_current_avatar_thumbnail_image_url':
entry.previousCurrentAvatarThumbnailImageUrl
} }
); );
} }
@@ -343,7 +354,4 @@ class Database {
var self = new Database(); var self = new Database();
window.database = self; window.database = self;
export { export {self as default, Database};
self as default,
Database
};
+9 -13
View File
@@ -6,13 +6,13 @@ function transformKey(key) {
class SharedRepository { class SharedRepository {
remove(key) { remove(key) {
key = transformKey(key); var _key = transformKey(key);
return SharedVariable.Remove(key); return SharedVariable.Remove(_key);
} }
getString(key, defaultValue = null) { getString(key, defaultValue = null) {
key = transformKey(key); var _key = transformKey(key);
var value = SharedVariable.Get(key); var value = SharedVariable.Get(_key);
if (value === null) { if (value === null) {
return defaultValue; return defaultValue;
} }
@@ -20,9 +20,9 @@ class SharedRepository {
} }
setString(key, value) { setString(key, value) {
key = transformKey(key); var _key = transformKey(key);
value = String(value); var _value = String(value);
SharedVariable.Set(key, value); SharedVariable.Set(_key, _value);
} }
getBool(key, defaultValue = null) { getBool(key, defaultValue = null) {
@@ -76,8 +76,7 @@ class SharedRepository {
} }
try { try {
value = JSON.parse(value); value = JSON.parse(value);
} catch (err) { } catch (err) {}
}
if (value !== Object(value)) { if (value !== Object(value)) {
return defaultValue; return defaultValue;
} }
@@ -104,7 +103,4 @@ class SharedRepository {
var self = new SharedRepository(); var self = new SharedRepository();
window.sharedRepository = self; window.sharedRepository = self;
export { export {self as default, SharedRepository};
self as default,
SharedRepository
};
+51 -51
View File
@@ -1,67 +1,67 @@
const defaultAESKey = new TextEncoder().encode( const defaultAESKey = new TextEncoder().encode(
'https://github.com/pypy-vrc/VRCX' 'https://github.com/pypy-vrc/VRCX'
) );
const hexToUint8Array = (hexStr) => { const hexToUint8Array = (hexStr) => {
const r = hexStr.match(/.{1,2}/g) const r = hexStr.match(/.{1,2}/g);
if (!r) return null if (!r) return null;
return new Uint8Array(r.map((b) => parseInt(b, 16))) return new Uint8Array(r.map((b) => parseInt(b, 16)));
} };
const uint8ArrayToHex = (arr) => const uint8ArrayToHex = (arr) =>
arr.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '') arr.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
function stdAESKey(key) { function stdAESKey(key) {
const tKey = new TextEncoder().encode(key) const tKey = new TextEncoder().encode(key);
let sk = tKey let sk = tKey;
if (key.length < 32) { if (key.length < 32) {
sk = new Uint8Array(32) sk = new Uint8Array(32);
sk.set(tKey) sk.set(tKey);
sk.set(defaultAESKey.slice(key.length, 32), key.length) sk.set(defaultAESKey.slice(key.length, 32), key.length);
} }
return sk.slice(0, 32) return sk.slice(0, 32);
} }
async function encrypt(plaintext, key) { async function encrypt(plaintext, key) {
let iv = window.crypto.getRandomValues(new Uint8Array(12)) let iv = window.crypto.getRandomValues(new Uint8Array(12));
let sharedKey = await window.crypto.subtle.importKey( let sharedKey = await window.crypto.subtle.importKey(
'raw', 'raw',
stdAESKey(key), stdAESKey(key),
{ name: 'AES-GCM', length: 256 }, {name: 'AES-GCM', length: 256},
true, true,
['encrypt'] ['encrypt']
) );
let cipher = await window.crypto.subtle.encrypt( let cipher = await window.crypto.subtle.encrypt(
{ name: 'AES-GCM', iv }, {name: 'AES-GCM', iv},
sharedKey, sharedKey,
new TextEncoder().encode(plaintext) new TextEncoder().encode(plaintext)
) );
let ciphertext = new Uint8Array(cipher) let ciphertext = new Uint8Array(cipher);
let encrypted = new Uint8Array(iv.length + ciphertext.byteLength) let encrypted = new Uint8Array(iv.length + ciphertext.byteLength);
encrypted.set(iv, 0) encrypted.set(iv, 0);
encrypted.set(ciphertext, iv.length) encrypted.set(ciphertext, iv.length);
return uint8ArrayToHex(encrypted) return uint8ArrayToHex(encrypted);
} }
async function decrypt(ciphertext, key) { async function decrypt(ciphertext, key) {
let text = hexToUint8Array(ciphertext) let text = hexToUint8Array(ciphertext);
if (!text) return '' if (!text) return '';
let sharedKey = await window.crypto.subtle.importKey( let sharedKey = await window.crypto.subtle.importKey(
'raw', 'raw',
stdAESKey(key), stdAESKey(key),
{ name: 'AES-GCM', length: 256 }, {name: 'AES-GCM', length: 256},
true, true,
['decrypt'] ['decrypt']
) );
let plaintext = await window.crypto.subtle.decrypt( let plaintext = await window.crypto.subtle.decrypt(
{ name: 'AES-GCM', iv: text.slice(0, 12) }, {name: 'AES-GCM', iv: text.slice(0, 12)},
sharedKey, sharedKey,
text.slice(12) text.slice(12)
) );
return new TextDecoder().decode(new Uint8Array(plaintext)) return new TextDecoder().decode(new Uint8Array(plaintext));
} }
export default { export default {
decrypt, decrypt,
encrypt, encrypt
} };
+1 -4
View File
@@ -94,7 +94,4 @@ class GameLogService {
var self = new GameLogService(); var self = new GameLogService();
window.gameLogService = self; window.gameLogService = self;
export { export {self as default, GameLogService as LogWatcherService};
self as default,
GameLogService as LogWatcherService
};
+14 -13
View File
@@ -3,15 +3,19 @@
class SQLiteService { class SQLiteService {
execute(callback, sql, args = null) { execute(callback, sql, args = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
SQLite.Execute((err, data) => { SQLite.Execute(
if (err !== null) { (err, data) => {
reject(err); if (err !== null) {
} else if (data === null) { reject(err);
resolve(); } else if (data === null) {
} else { resolve();
callback(data); } else {
} callback(data);
}, sql, args); }
},
sql,
args
);
}); });
} }
@@ -23,7 +27,4 @@ class SQLiteService {
var self = new SQLiteService(); var self = new SQLiteService();
window.sqliteService = self; window.sqliteService = self;
export { export {self as default, SQLiteService};
self as default,
SQLiteService
};
+1 -4
View File
@@ -21,7 +21,4 @@ class WebApiService {
var self = new WebApiService(); var self = new WebApiService();
window.webApiService = self; window.webApiService = self;
export { export {self as default, WebApiService};
self as default,
WebApiService
};
+142 -111
View File
@@ -42,10 +42,12 @@ speechSynthesis.getVoices();
locale locale
}); });
var escapeTag = (s) => String(s).replace(/["&'<>]/gu, (c) => `&#${c.charCodeAt(0)};`); var escapeTag = (s) =>
String(s).replace(/["&'<>]/gu, (c) => `&#${c.charCodeAt(0)};`);
Vue.filter('escapeTag', escapeTag); Vue.filter('escapeTag', escapeTag);
var commaNumber = (n) => String(Number(n) || 0).replace(/(\d)(?=(\d{3})+(?!\d))/gu, '$1,'); var commaNumber = (n) =>
String(Number(n) || 0).replace(/(\d)(?=(\d{3})+(?!\d))/gu, '$1,');
Vue.filter('commaNumber', commaNumber); Vue.filter('commaNumber', commaNumber);
var formatDate = (s, format) => { var formatDate = (s, format) => {
@@ -55,24 +57,27 @@ speechSynthesis.getVoices();
} }
var hours = dt.getHours(); var hours = dt.getHours();
var map = { var map = {
'YYYY': String(10000 + dt.getFullYear()).substr(-4), YYYY: String(10000 + dt.getFullYear()).substr(-4),
'MM': String(101 + dt.getMonth()).substr(-2), MM: String(101 + dt.getMonth()).substr(-2),
'DD': String(100 + dt.getDate()).substr(-2), DD: String(100 + dt.getDate()).substr(-2),
'HH24': String(100 + hours).substr(-2), HH24: String(100 + hours).substr(-2),
'HH': String(100 + (hours > 12 HH: String(100 + (hours > 12 ? hours - 12 : hours)).substr(-2),
? hours - 12 MI: String(100 + dt.getMinutes()).substr(-2),
: hours)).substr(-2), SS: String(100 + dt.getSeconds()).substr(-2),
'MI': String(100 + dt.getMinutes()).substr(-2), AMPM: hours >= 12 ? 'PM' : 'AM'
'SS': String(100 + dt.getSeconds()).substr(-2),
'AMPM': hours >= 12
? 'PM'
: 'AM'
}; };
return format.replace(/YYYY|MM|DD|HH24|HH|MI|SS|AMPM/gu, (c) => map[c] || c); return format.replace(
/YYYY|MM|DD|HH24|HH|MI|SS|AMPM/gu,
(c) => map[c] || c
);
}; };
Vue.filter('formatDate', formatDate); Vue.filter('formatDate', formatDate);
var textToHex = (s) => String(s).split('').map((c) => c.charCodeAt(0).toString(16)).join(' '); var textToHex = (s) =>
String(s)
.split('')
.map((c) => c.charCodeAt(0).toString(16))
.join(' ');
Vue.filter('textToHex', textToHex); Vue.filter('textToHex', textToHex);
var timeToText = (t) => { var timeToText = (t) => {
@@ -97,8 +102,7 @@ speechSynthesis.getVoices();
arr.push(`${Math.floor(sec / 60)}m`); arr.push(`${Math.floor(sec / 60)}m`);
sec %= 60; sec %= 60;
} }
if (sec || if (sec || !arr.length) {
!arr.length) {
arr.push(`${sec}s`); arr.push(`${sec}s`);
} }
return arr.join(' '); return arr.join(' ');
@@ -142,7 +146,7 @@ speechSynthesis.getVoices();
if (typeof handlers === 'undefined') { if (typeof handlers === 'undefined') {
return; return;
} }
var { length } = handlers; var {length} = handlers;
for (var i = 0; i < length; ++i) { for (var i = 0; i < length; ++i) {
if (handlers[i] === handler) { if (handlers[i] === handler) {
if (length > 1) { if (length > 1) {
@@ -163,13 +167,13 @@ speechSynthesis.getVoices();
method: 'GET', method: 'GET',
...options ...options
}; };
var { params } = init; var {params} = init;
var isGetRequest = init.method === 'GET'; var isGetRequest = init.method === 'GET';
if (isGetRequest === true) { if (isGetRequest === true) {
// transform body to url // transform body to url
if (params === Object(params)) { if (params === Object(params)) {
var url = new URL(init.url); var url = new URL(init.url);
var { searchParams } = url; var {searchParams} = url;
for (var key in params) { for (var key in params) {
searchParams.set(key, params[key]); searchParams.set(key, params[key]);
} }
@@ -185,54 +189,53 @@ speechSynthesis.getVoices();
'Content-Type': 'application/json;charset=utf-8', 'Content-Type': 'application/json;charset=utf-8',
...init.headers ...init.headers
}; };
init.body = params === Object(params) init.body =
? JSON.stringify(params) params === Object(params) ? JSON.stringify(params) : '{}';
: '{}';
} }
init.headers = { init.headers = {
'User-Agent': appVersion, 'User-Agent': appVersion,
...init.headers ...init.headers
}; };
var req = webApiService.execute(init).catch((err) => { var req = webApiService
this.$throw(0, err); .execute(init)
}).then((response) => { .catch((err) => {
try { this.$throw(0, err);
response.data = JSON.parse(response.data); })
return response; .then((response) => {
} catch (e) { try {
} response.data = JSON.parse(response.data);
if (response.status === 200) { return response;
this.$throw(0, 'Invalid JSON response'); } catch (e) {}
} if (response.status === 200) {
this.$throw(response.status); this.$throw(0, 'Invalid JSON response');
return {}; }
}).then(({ data, status }) => { this.$throw(response.status);
if (data === Object(data)) { return {};
if (status === 200) { })
if (data.success === Object(data.success)) { .then(({data, status}) => {
new Noty({ if (data === Object(data)) {
type: 'success', if (status === 200) {
text: escapeTag(data.success.message) if (data.success === Object(data.success)) {
}).show(); new Noty({
type: 'success',
text: escapeTag(data.success.message)
}).show();
}
return data;
}
if (data.error === Object(data.error)) {
this.$throw(
data.error.status_code || status,
data.error.message,
data.error.data
);
} else if (typeof data.error === 'string') {
this.$throw(data.status_code || status, data.error);
} }
return data;
} }
if (data.error === Object(data.error)) { this.$throw(status, data);
this.$throw( return data;
data.error.status_code || status, });
data.error.message,
data.error.data
);
} else if (typeof data.error === 'string') {
this.$throw(
data.status_code || status,
data.error
);
}
}
this.$throw(status, data);
return data;
});
if (isGetRequest === true) { if (isGetRequest === true) {
req.finally(() => { req.finally(() => {
this.pendingGetRequests.delete(init.url); this.pendingGetRequests.delete(init.url);
@@ -373,9 +376,9 @@ speechSynthesis.getVoices();
// API: Location // API: Location
API.parseLocation = function (tag) { API.parseLocation = function (tag) {
tag = String(tag || ''); var _tag = String(tag || '');
var ctx = { var ctx = {
tag, tag: _tag,
isOffline: false, isOffline: false,
isPrivate: false, isPrivate: false,
worldId: '', worldId: '',
@@ -389,27 +392,21 @@ speechSynthesis.getVoices();
friendsId: null, friendsId: null,
canRequestInvite: false canRequestInvite: false
}; };
if (tag === 'offline') { if (_tag === 'offline') {
ctx.isOffline = true; ctx.isOffline = true;
} else if (tag === 'private') { } else if (_tag === 'private') {
ctx.isPrivate = true; ctx.isPrivate = true;
} else if (tag.startsWith('local') === false) { } else if (_tag.startsWith('local') === false) {
var sep = tag.indexOf(':'); var sep = _tag.indexOf(':');
if (sep >= 0) { if (sep >= 0) {
ctx.worldId = tag.substr(0, sep); ctx.worldId = _tag.substr(0, sep);
ctx.instanceId = tag.substr(sep + 1); ctx.instanceId = _tag.substr(sep + 1);
ctx.instanceId.split('~').forEach((s, i) => { ctx.instanceId.split('~').forEach((s, i) => {
if (i) { if (i) {
var A = s.indexOf('('); var A = s.indexOf('(');
var Z = A >= 0 var Z = A >= 0 ? s.lastIndexOf(')') : -1;
? s.lastIndexOf(')') var key = Z >= 0 ? s.substr(0, A) : s;
: -1; var value = A < Z ? s.substr(A + 1, Z - A - 1) : '';
var key = Z >= 0
? s.substr(0, A)
: s;
var value = A < Z
? s.substr(A + 1, Z - A - 1)
: '';
if (key === 'hidden') { if (key === 'hidden') {
ctx.hiddenId = value; ctx.hiddenId = value;
} else if (key === 'private') { } else if (key === 'private') {
@@ -445,14 +442,15 @@ speechSynthesis.getVoices();
ctx.userId = ctx.hiddenId; ctx.userId = ctx.hiddenId;
} }
} else { } else {
ctx.worldId = tag; ctx.worldId = _tag;
} }
} }
return ctx; return ctx;
}; };
Vue.component('location', { Vue.component('location', {
template: '<span>{{ text }}<slot></slot><span class="famfamfam-flags" :class="region" style="display:inline-block;margin-left:5px"></span></span>', template:
'<span>{{ text }}<slot></slot><span class="famfamfam-flags" :class="region" style="display:inline-block;margin-left:5px"></span></span>',
props: { props: {
location: String, location: String,
hint: { hint: {
@@ -488,7 +486,12 @@ speechSynthesis.getVoices();
} }
} }
this.region = ''; this.region = '';
if ((this.location !== '') && (L.instanceId) && (!L.isOffline) && (!L.isPrivate)) { if (
this.location !== '' &&
L.instanceId &&
!L.isOffline &&
!L.isPrivate
) {
if (L.region === 'eu') { if (L.region === 'eu') {
this.region = 'europeanunion'; this.region = 'europeanunion';
} else if (L.region === 'jp') { } else if (L.region === 'jp') {
@@ -626,7 +629,7 @@ speechSynthesis.getVoices();
props[prop] = true; props[prop] = true;
} }
} }
var $ref = { ...ref }; var $ref = {...ref};
Object.assign(ref, json); Object.assign(ref, json);
for (var prop in ref) { for (var prop in ref) {
if (ref[prop] !== Object(ref[prop])) { if (ref[prop] !== Object(ref[prop])) {
@@ -639,10 +642,7 @@ speechSynthesis.getVoices();
if (asis === tobe) { if (asis === tobe) {
delete props[prop]; delete props[prop];
} else { } else {
props[prop] = [ props[prop] = [tobe, asis];
tobe,
asis
];
} }
} }
} }
@@ -734,21 +734,25 @@ speechSynthesis.getVoices();
// OO has muted you // OO has muted you
// OO has hidden you // OO has hidden you
// -- // --
API.getConfig().catch((err) => { API.getConfig()
// FIXME: 어케 복구하냐 이건 .catch((err) => {
throw err; // FIXME: 어케 복구하냐 이건
}).then((args) => { throw err;
if (this.appType === '1') { })
this.updateCpuUsageLoop(); .then((args) => {
} if (this.appType === '1') {
this.initLoop(); this.updateCpuUsageLoop();
return args; }
}); this.initLoop();
return args;
});
} }
}; };
$app.methods.updateVRConfigVars = function () { $app.methods.updateVRConfigVars = function () {
this.currentUserStatus = sharedRepository.getString('current_user_status'); this.currentUserStatus = sharedRepository.getString(
'current_user_status'
);
this.isGameRunning = sharedRepository.getBool('is_game_running'); this.isGameRunning = sharedRepository.getBool('is_game_running');
this.isGameNoVR = sharedRepository.getBool('is_Game_No_VR'); this.isGameNoVR = sharedRepository.getBool('is_Game_No_VR');
this.downloadProgress = sharedRepository.getInt('downloadProgress'); this.downloadProgress = sharedRepository.getInt('downloadProgress');
@@ -756,7 +760,9 @@ speechSynthesis.getVoices();
if (lastLocation) { if (lastLocation) {
this.lastLocation = lastLocation; this.lastLocation = lastLocation;
if (this.lastLocation.date !== 0) { if (this.lastLocation.date !== 0) {
this.lastLocationTimer = timeToText(Date.now() - this.lastLocation.date); this.lastLocationTimer = timeToText(
Date.now() - this.lastLocation.date
);
} else { } else {
this.lastLocationTimer = ''; this.lastLocationTimer = '';
} }
@@ -794,14 +800,16 @@ speechSynthesis.getVoices();
} else { } else {
console.error('missing displayName'); console.error('missing displayName');
} }
if ((displayName) && (!this.notyMap[displayName]) || if (
(this.notyMap[displayName] < feed.created_at)) { (displayName && !this.notyMap[displayName]) ||
this.notyMap[displayName] < feed.created_at
) {
this.notyMap[displayName] = feed.created_at; this.notyMap[displayName] = feed.created_at;
} }
}); });
}; };
$app.methods.initLoop = async function () { $app.methods.initLoop = function () {
if (!sharedRepository.getBool('VRInit')) { if (!sharedRepository.getBool('VRInit')) {
setTimeout(this.initLoop, 500); setTimeout(this.initLoop, 500);
} else { } else {
@@ -813,7 +821,7 @@ speechSynthesis.getVoices();
try { try {
this.currentTime = new Date().toJSON(); this.currentTime = new Date().toJSON();
await this.updateVRConfigVars(); await this.updateVRConfigVars();
if ((!this.config.hideDevicesFromFeed) && (this.appType === '1')) { if (!this.config.hideDevicesFromFeed && this.appType === '1') {
AppApi.GetVRDevices().then((devices) => { AppApi.GetVRDevices().then((devices) => {
devices.forEach((device) => { devices.forEach((device) => {
device[2] = parseInt(device[2], 10); device[2] = parseInt(device[2], 10);
@@ -865,8 +873,10 @@ speechSynthesis.getVoices();
} else { } else {
console.error('missing displayName'); console.error('missing displayName');
} }
if ((displayName) && (!this.notyMap[displayName]) || if (
(this.notyMap[displayName] < feed.created_at)) { (displayName && !this.notyMap[displayName]) ||
this.notyMap[displayName] < feed.created_at
) {
this.notyMap[displayName] = feed.created_at; this.notyMap[displayName] = feed.created_at;
notyToPlay.push(feed); notyToPlay.push(feed);
} }
@@ -877,7 +887,11 @@ speechSynthesis.getVoices();
} }
var bias = new Date(Date.now() - 60000).toJSON(); var bias = new Date(Date.now() - 60000).toJSON();
var noty = {}; var noty = {};
var messageList = ['inviteMessage', 'requestMessage', 'responseMessage']; var messageList = [
'inviteMessage',
'requestMessage',
'responseMessage'
];
for (var i = 0; i < notyToPlay.length; i++) { for (var i = 0; i < notyToPlay.length; i++) {
noty = notyToPlay[i]; noty = notyToPlay[i];
if (noty.created_at < bias) { if (noty.created_at < bias) {
@@ -885,14 +899,21 @@ speechSynthesis.getVoices();
} }
var message = ''; var message = '';
for (var k = 0; k < messageList.length; k++) { for (var k = 0; k < messageList.length; k++) {
if (typeof noty.details !== 'undefined' && typeof noty.details[messageList[k]] !== 'undefined') { if (
typeof noty.details !== 'undefined' &&
typeof noty.details[messageList[k]] !== 'undefined'
) {
message = noty.details[messageList[k]]; message = noty.details[messageList[k]];
} }
} }
if (message) { if (message) {
message = `, ${message}`; message = `, ${message}`;
} }
if ((this.config.overlayNotifications) && (!this.isGameNoVR) && (this.isGameRunning)) { if (
this.config.overlayNotifications &&
!this.isGameNoVR &&
this.isGameRunning
) {
var text = ''; var text = '';
switch (noty.type) { switch (noty.type) {
case 'OnPlayerJoined': case 'OnPlayerJoined':
@@ -905,7 +926,12 @@ speechSynthesis.getVoices();
text = `<strong>${noty.displayName}</strong> is joining`; text = `<strong>${noty.displayName}</strong> is joining`;
break; break;
case 'GPS': case 'GPS':
text = `<strong>${noty.displayName}</strong> is in ${this.displayLocation(noty.location, noty.worldName)}`; text = `<strong>${
noty.displayName
}</strong> is in ${this.displayLocation(
noty.location,
noty.worldName
)}`;
break; break;
case 'Online': case 'Online':
text = `<strong>${noty.displayName}</strong> has logged in`; text = `<strong>${noty.displayName}</strong> has logged in`;
@@ -917,7 +943,12 @@ speechSynthesis.getVoices();
text = `<strong>${noty.displayName}</strong> status is now <i>${noty.status}</i> ${noty.statusDescription}`; text = `<strong>${noty.displayName}</strong> status is now <i>${noty.status}</i> ${noty.statusDescription}`;
break; break;
case 'invite': case 'invite':
text = `<strong>${noty.senderUsername}</strong> has invited you to ${this.displayLocation(noty.details.worldId, noty.details.worldName)}${message}`; text = `<strong>${
noty.senderUsername
}</strong> has invited you to ${this.displayLocation(
noty.details.worldId,
noty.details.worldName
)}${message}`;
break; break;
case 'requestInvite': case 'requestInvite':
text = `<strong>${noty.senderUsername}</strong> has requested an invite ${message}`; text = `<strong>${noty.senderUsername}</strong> has requested an invite ${message}`;
@@ -1028,4 +1059,4 @@ speechSynthesis.getVoices();
$app = new Vue($app); $app = new Vue($app);
window.$app = $app; window.$app = $app;
}()); })();
+9 -7
View File
@@ -8,11 +8,11 @@
// For a copy, see <https://opensource.org/licenses/MIT>. // For a copy, see <https://opensource.org/licenses/MIT>.
// //
@import "~normalize.css/normalize.css"; @import '~normalize.css/normalize.css';
@import "~animate.css/animate.min.css"; @import '~animate.css/animate.min.css';
@import "~noty/lib/noty.css"; @import '~noty/lib/noty.css';
@import "~element-ui/lib/theme-chalk/index.css"; @import '~element-ui/lib/theme-chalk/index.css';
@import "~famfamfam-flags/dist/sprite/famfamfam-flags.min.css"; @import '~famfamfam-flags/dist/sprite/famfamfam-flags.min.css';
/* /*
마지노선인듯 마지노선인듯
@@ -163,9 +163,11 @@ input,
textarea, textarea,
select, select,
button { button {
font-family: "Noto Sans JP", "Noto Sans KR", "Meiryo UI", "Malgun Gothic", "Segoe UI", sans-serif; font-family: 'Noto Sans JP', 'Noto Sans KR', 'Meiryo UI', 'Malgun Gothic',
'Segoe UI', sans-serif;
line-height: normal; line-height: normal;
text-shadow: #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px; text-shadow: #000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px,
#000 0px 0px 1px, #000 0px 0px 1px, #000 0px 0px 1px;
} }
.x-app { .x-app {