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