summaryrefslogtreecommitdiff
path: root/src/client/app/common/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/common/scripts')
-rw-r--r--src/client/app/common/scripts/check-for-update.ts2
-rw-r--r--src/client/app/common/scripts/gcd.ts2
-rw-r--r--src/client/app/common/scripts/parse-search-query.ts53
-rw-r--r--src/client/app/common/scripts/streaming/stream-manager.ts3
4 files changed, 3 insertions, 57 deletions
diff --git a/src/client/app/common/scripts/check-for-update.ts b/src/client/app/common/scripts/check-for-update.ts
index 4445eefc39..91b165b45d 100644
--- a/src/client/app/common/scripts/check-for-update.ts
+++ b/src/client/app/common/scripts/check-for-update.ts
@@ -9,7 +9,7 @@ export default async function(mios: MiOS, force = false, silent = false) {
localStorage.setItem('should-refresh', 'true');
localStorage.setItem('v', newer);
- // Clear cache (serive worker)
+ // Clear cache (service worker)
try {
if (navigator.serviceWorker.controller) {
navigator.serviceWorker.controller.postMessage('clear');
diff --git a/src/client/app/common/scripts/gcd.ts b/src/client/app/common/scripts/gcd.ts
deleted file mode 100644
index 9a19f9da66..0000000000
--- a/src/client/app/common/scripts/gcd.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-const gcd = (a, b) => !b ? a : gcd(b, a % b);
-export default gcd;
diff --git a/src/client/app/common/scripts/parse-search-query.ts b/src/client/app/common/scripts/parse-search-query.ts
deleted file mode 100644
index 5f6ae3320a..0000000000
--- a/src/client/app/common/scripts/parse-search-query.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-export default function(qs: string) {
- const q = {
- text: ''
- };
-
- qs.split(' ').forEach(x => {
- if (/^([a-z_]+?):(.+?)$/.test(x)) {
- const [key, value] = x.split(':');
- switch (key) {
- case 'user':
- q['includeUserUsernames'] = value.split(',');
- break;
- case 'exclude_user':
- q['excludeUserUsernames'] = value.split(',');
- break;
- case 'follow':
- q['following'] = value == 'null' ? null : value == 'true';
- break;
- case 'reply':
- q['reply'] = value == 'null' ? null : value == 'true';
- break;
- case 'renote':
- q['renote'] = value == 'null' ? null : value == 'true';
- break;
- case 'media':
- q['media'] = value == 'null' ? null : value == 'true';
- break;
- case 'poll':
- q['poll'] = value == 'null' ? null : value == 'true';
- break;
- case 'until':
- case 'since':
- // YYYY-MM-DD
- if (/^[0-9]+\-[0-9]+\-[0-9]+$/) {
- const [yyyy, mm, dd] = value.split('-');
- q[`${key}_date`] = (new Date(parseInt(yyyy, 10), parseInt(mm, 10) - 1, parseInt(dd, 10))).getTime();
- }
- break;
- default:
- q[key] = value;
- break;
- }
- } else {
- q.text += x + ' ';
- }
- });
-
- if (q.text) {
- q.text = q.text.trim();
- }
-
- return q;
-}
diff --git a/src/client/app/common/scripts/streaming/stream-manager.ts b/src/client/app/common/scripts/streaming/stream-manager.ts
index 568b8b0372..8dd06f67d3 100644
--- a/src/client/app/common/scripts/streaming/stream-manager.ts
+++ b/src/client/app/common/scripts/streaming/stream-manager.ts
@@ -1,6 +1,7 @@
import { EventEmitter } from 'eventemitter3';
import * as uuid from 'uuid';
import Connection from './stream';
+import { erase } from '../../../../../prelude/array';
/**
* ストリーム接続を管理するクラス
@@ -89,7 +90,7 @@ export default abstract class StreamManager<T extends Connection> extends EventE
* @param userId use で発行したユーザーID
*/
public dispose(userId) {
- this.users = this.users.filter(id => id != userId);
+ this.users = erase(userId, this.users);
this._connection.user = `Managed (${ this.users.length })`;