@@ -32,6 +32,7 @@ import { defineComponent } from 'vue';
import { faTimes } from '@fortawesome/free-solid-svg-icons';
import paging from '../scripts/paging';
import XModal from './modal.vue';
+import { userPage } from '../filters/user';
export default defineComponent({
components: {
@@ -64,6 +65,7 @@ export default defineComponent({
close() {
this.$refs.modal.close();
},
+ userPage
}
});
diff --git a/src/client/filters/bytes.ts b/src/client/filters/bytes.ts
index 5b5d966cfd..874a72d047 100644
--- a/src/client/filters/bytes.ts
+++ b/src/client/filters/bytes.ts
@@ -1,6 +1,4 @@
-import Vue from 'vue';
-
-Vue.filter('bytes', (v, digits = 0) => {
+export default (v, digits = 0) => {
if (v == null) return '?';
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
if (v == 0) return '0';
@@ -8,4 +6,4 @@ Vue.filter('bytes', (v, digits = 0) => {
if (isMinus) v = -v;
const i = Math.floor(Math.log(v) / Math.log(1024));
return (isMinus ? '-' : '') + (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i];
-});
+};
\ No newline at end of file
diff --git a/src/client/filters/note.ts b/src/client/filters/note.ts
index 3c9c8b7485..0666085a27 100644
--- a/src/client/filters/note.ts
+++ b/src/client/filters/note.ts
@@ -1,5 +1,3 @@
-import Vue from 'vue';
-
-Vue.filter('notePage', note => {
+export default note => {
return `/notes/${note.id}`;
-});
+};
\ No newline at end of file
diff --git a/src/client/filters/number.ts b/src/client/filters/number.ts
index 8c799d9442..98866cc961 100644
--- a/src/client/filters/number.ts
+++ b/src/client/filters/number.ts
@@ -1,3 +1 @@
-import Vue from 'vue';
-
-Vue.filter('number', n => n == null ? 'N/A' : n.toLocaleString());
+export default n => n == null ? 'N/A' : n.toLocaleString()
\ No newline at end of file
diff --git a/src/client/filters/user.ts b/src/client/filters/user.ts
index e8f10c3db6..c57402a963 100644
--- a/src/client/filters/user.ts
+++ b/src/client/filters/user.ts
@@ -1,16 +1,15 @@
-import Vue from 'vue';
import getAcct from '../../misc/acct/render';
import getUserName from '../../misc/get-user-name';
import { url } from '../config';
-Vue.filter('acct', user => {
+export const acct = user => {
return getAcct(user);
-});
+}
-Vue.filter('userName', user => {
+export const userName = user => {
return getUserName(user);
-});
+}
-Vue.filter('userPage', (user, path?, absolute = false) => {
- return `${absolute ? url : ''}/@${Vue.filter('acct')(user)}${(path ? `/${path}` : '')}`;
-});
+export const userPage = (user, path?, absolute = false) => {
+ return `${absolute ? url : ''}/@${acct(user)}${(path ? `/${path}` : '')}`;
+}
\ No newline at end of file
diff --git a/src/client/pages/explore.vue b/src/client/pages/explore.vue
index 4a5a1fd032..d6ca0d7b6f 100644
--- a/src/client/pages/explore.vue
+++ b/src/client/pages/explore.vue
@@ -59,6 +59,7 @@ import { faChartLine, faPlus, faHashtag, faRocket } from '@fortawesome/free-soli
import { faBookmark, faCommentAlt } from '@fortawesome/free-regular-svg-icons';
import XUserList from '../components/user-list.vue';
import MkContainer from '../components/ui/container.vue';
+import number from '../filters/number';
export default defineComponent({
metaInfo() {
@@ -112,7 +113,7 @@ export default defineComponent({
tagsLocal: [],
tagsRemote: [],
stats: null,
- num: Vue.filter('number'),
+ num: number,
faBookmark, faChartLine, faCommentAlt, faPlus, faHashtag, faRocket
};
},
diff --git a/src/client/pages/follow-requests.vue b/src/client/pages/follow-requests.vue
index 71c73809a3..8483c655b0 100644
--- a/src/client/pages/follow-requests.vue
+++ b/src/client/pages/follow-requests.vue
@@ -15,8 +15,8 @@
-
-
@{{ req.follower | acct }}
+
+
@{{ acct(req.follower) }}
@@ -36,6 +36,7 @@
import { defineComponent } from 'vue';
import { faUserClock, faCheck, faTimes } from '@fortawesome/free-solid-svg-icons';
import MkPagination from '../components/ui/pagination.vue';
+import { userPage, acct } from '../filters/user';
export default defineComponent({
metaInfo() {
@@ -68,7 +69,9 @@ export default defineComponent({
this.$root.api('following/requests/reject', { userId: user.id }).then(() => {
this.$refs.list.reload();
});
- }
+ },
+ userPage,
+ acct
}
});
diff --git a/src/client/pages/instance/federation.instance.vue b/src/client/pages/instance/federation.instance.vue
index cb72b4fd85..c51303942d 100644
--- a/src/client/pages/instance/federation.instance.vue
+++ b/src/client/pages/instance/federation.instance.vue
@@ -24,31 +24,31 @@
{{ $t('following') }}
-
{{ instance.followingCount | number }}
+
{{ number(instance.followingCount) }}
{{ $t('followers') }}
-
{{ instance.followersCount | number }}
+
{{ number(instance.followersCount) }}
{{ $t('users') }}
-
{{ instance.usersCount | number }}
+
{{ number(instance.usersCount) }}
{{ $t('notes') }}
-
{{ instance.notesCount | number }}
+
{{ number(instance.notesCount) }}
{{ $t('files') }}
-
{{ instance.driveFiles | number }}
+
{{ number(instance.driveFiles) }}
{{ $t('storageUsage') }}
-
{{ instance.driveUsage | bytes }}
+
{{ bytes(instance.driveUsage) }}
@@ -127,6 +127,8 @@ import MkSelect from '../../components/ui/select.vue';
import MkButton from '../../components/ui/button.vue';
import MkSwitch from '../../components/ui/switch.vue';
import MkInfo from '../../components/ui/info.vue';
+import bytes from '../../filters/bytes';
+import number from '../../filters/number';
const chartLimit = 90;
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
@@ -220,7 +222,7 @@ export default defineComponent({
}
},
- async created() {
+ async created() {
this.now = new Date();
const [perHour, perDay] = await Promise.all([
@@ -474,7 +476,11 @@ export default defineComponent({
}
}
});
- }
+ },
+
+ bytes,
+
+ number
}
});
diff --git a/src/client/pages/instance/index.vue b/src/client/pages/instance/index.vue
index d4b0aec360..a61793737a 100644
--- a/src/client/pages/instance/index.vue
+++ b/src/client/pages/instance/index.vue
@@ -48,9 +48,9 @@
CPU
{{ serverInfo.cpu.model }}
-
MEM total
{{ serverInfo.mem.total | bytes }}
-
MEM used
{{ memUsage | bytes }} ({{ (memUsage / serverInfo.mem.total * 100).toFixed(0) }}%)
-
MEM free
{{ serverInfo.mem.total - memUsage | bytes }} ({{ ((serverInfo.mem.total - memUsage) / serverInfo.mem.total * 100).toFixed(0) }}%)
+
MEM total
{{ bytes(serverInfo.mem.total) }}
+
MEM used
{{ bytes(memUsage) }} ({{ (memUsage / serverInfo.mem.total * 100).toFixed(0) }}%)
+
MEM free
{{ bytes(serverInfo.mem.total - memUsage) }} ({{ ((serverInfo.mem.total - memUsage) / serverInfo.mem.total * 100).toFixed(0) }}%)
@@ -63,9 +63,9 @@
-
Disk total
{{ serverInfo.fs.total | bytes }}
-
Disk used
{{ serverInfo.fs.used | bytes }} ({{ (serverInfo.fs.used / serverInfo.fs.total * 100).toFixed(0) }}%)
-
Disk free
{{ serverInfo.fs.total - serverInfo.fs.used | bytes }} ({{ ((serverInfo.fs.total - serverInfo.fs.used) / serverInfo.fs.total * 100).toFixed(0) }}%)
+
Disk total
{{ bytes(serverInfo.fs.total) }}
+
Disk used
{{ bytes(serverInfo.fs.used) }} ({{ (serverInfo.fs.used / serverInfo.fs.total * 100).toFixed(0) }}%)
+
Disk free
{{ bytes(serverInfo.fs.total - serverInfo.fs.used) }} ({{ ((serverInfo.fs.total - serverInfo.fs.used) / serverInfo.fs.total * 100).toFixed(0) }}%)
@@ -107,6 +107,7 @@ import MkButton from '../../components/ui/button.vue';
import MkSelect from '../../components/ui/select.vue';
import MkInput from '../../components/ui/input.vue';
import { version, url } from '../../config';
+import bytes from '../../filters/bytes';
const alpha = (hex, a) => {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)!;
@@ -167,7 +168,7 @@ export default defineComponent({
mounted() {
this.fetchLogs();
-
+
Chart.defaults.global.defaultFontColor = getComputedStyle(document.documentElement).getPropertyValue('--fg');
this.chartCpuMem = new Chart(this.$refs.cpumem, {
@@ -439,7 +440,9 @@ export default defineComponent({
for (const stats of statsLog.reverse()) {
this.onStats(stats);
}
- }
+ },
+
+ bytes
}
});
diff --git a/src/client/pages/instance/queue.queue.vue b/src/client/pages/instance/queue.queue.vue
index b35b0119b5..ff6a389794 100644
--- a/src/client/pages/instance/queue.queue.vue
+++ b/src/client/pages/instance/queue.queue.vue
@@ -2,10 +2,10 @@
-
Process
{{ activeSincePrevTick | number }}
-
Active
{{ active | number }}
-
Waiting
{{ waiting | number }}
-
Delayed
{{ delayed | number }}
+
Process
{{ number(activeSincePrevTick) }}
+
Active
{{ number(active) }}
+
Waiting
{{ number(waiting) }}
+
Delayed
{{ number(delayed) }}
@@ -14,7 +14,7 @@
{{ job[0] }}
- ({{ job[1] | number }} jobs)
+ ({{ number(job[1]) }} jobs)
{{ $t('noJobs') }}
@@ -25,6 +25,7 @@
diff --git a/src/client/pages/instance/users.user.vue b/src/client/pages/instance/users.user.vue
index f6b8db593d..17c78f841f 100644
--- a/src/client/pages/instance/users.user.vue
+++ b/src/client/pages/instance/users.user.vue
@@ -7,7 +7,7 @@
-
@{{ user | acct }}
+
@{{ acct(user) }}
@@ -40,6 +40,7 @@ import { faSnowflake, faTrashAlt, faBookmark as farBookmark } from '@fortawesom
import MkButton from '../../components/ui/button.vue';
import MkSwitch from '../../components/ui/switch.vue';
import Progress from '../../scripts/loading';
+import { acct, userPage } from '../../filters/user';
export default defineComponent({
components: {
@@ -84,7 +85,7 @@ export default defineComponent({
},
openProfile() {
- window.open(Vue.filter('userPage')(this.user, null, true), '_blank');
+ window.open(userPage(this.user, null, true), '_blank');
},
async updateRemoteUser() {
@@ -175,6 +176,8 @@ export default defineComponent({
});
await this.refreshUser();
},
+
+ acct
}
});
diff --git a/src/client/pages/instance/users.vue b/src/client/pages/instance/users.vue
index 58e45e99a6..7705c9a745 100644
--- a/src/client/pages/instance/users.vue
+++ b/src/client/pages/instance/users.vue
@@ -59,7 +59,7 @@
- @{{ user | acct }}
+ @{{ acct(user) }}
@@ -92,6 +92,7 @@ import MkInput from '../../components/ui/input.vue';
import MkSelect from '../../components/ui/select.vue';
import MkPagination from '../../components/ui/pagination.vue';
import MkUserSelect from '../../components/user-select.vue';
+import { acct } from '../../filters/user';
export default defineComponent({
metaInfo() {
@@ -223,7 +224,9 @@ export default defineComponent({
async show(user) {
this.$router.push('./users/' + user.id);
- }
+ },
+
+ acct
}
});
@@ -234,7 +237,7 @@ export default defineComponent({
> ._content {
max-height: 300px;
overflow: auto;
-
+
> .users {
> .user {
display: flex;
diff --git a/src/client/pages/messaging/index.vue b/src/client/pages/messaging/index.vue
index 49084961b5..3edc630387 100644
--- a/src/client/pages/messaging/index.vue
+++ b/src/client/pages/messaging/index.vue
@@ -22,7 +22,7 @@
- @{{ isMe(message) ? message.recipient : message.user | acct }}
+ @{{ acct(isMe(message) ? message.recipient : message.user) }}
@@ -45,6 +45,7 @@ import { faUser, faUsers, faComments, faPlus } from '@fortawesome/free-solid-svg
import getAcct from '../../../misc/acct/render';
import MkButton from '../../components/ui/button.vue';
import MkUserSelect from '../../components/user-select.vue';
+import { acct } from '../../filters/user';
export default defineComponent({
components: {
@@ -159,7 +160,9 @@ export default defineComponent({
});
if (canceled) return;
this.$router.push(`/my/messaging/group/${group.id}`);
- }
+ },
+
+ acct
}
});
diff --git a/src/client/pages/my-settings/mute-block.vue b/src/client/pages/my-settings/mute-block.vue
index 85f51d7d82..4d73dcf93e 100644
--- a/src/client/pages/my-settings/mute-block.vue
+++ b/src/client/pages/my-settings/mute-block.vue
@@ -7,7 +7,7 @@
{{ $t('noUsers') }}
-
+
@@ -20,7 +20,7 @@
{{ $t('noUsers') }}
-
+
@@ -34,6 +34,7 @@
import { defineComponent } from 'vue';
import { faBan } from '@fortawesome/free-solid-svg-icons';
import MkPagination from '../../components/ui/pagination.vue';
+import { userPage } from '../../filters/user';
export default defineComponent({
components: {
@@ -53,6 +54,10 @@ export default defineComponent({
faBan
}
},
+
+ methods: {
+ userPage
+ }
});
diff --git a/src/client/pages/user/follow-list.vue b/src/client/pages/user/follow-list.vue
index 7d2ce353f9..4c816bf6a4 100644
--- a/src/client/pages/user/follow-list.vue
+++ b/src/client/pages/user/follow-list.vue
@@ -4,8 +4,8 @@
-
-
@{{ user | acct }}
+
+
@{{ acct(user) }}
@@ -21,6 +21,7 @@ import { defineComponent } from 'vue';
import parseAcct from '../../../misc/acct/parse';
import MkFollowButton from '../../components/follow-button.vue';
import MkPagination from '../../components/ui/pagination.vue';
+import { userPage, acct } from '../../filters/user';
export default defineComponent({
components: {
@@ -55,6 +56,12 @@ export default defineComponent({
'$route'() {
this.$refs.list.reload();
}
+ },
+
+ methods: {
+ userPage,
+
+ acct
}
});
diff --git a/src/client/pages/user/index.photos.vue b/src/client/pages/user/index.photos.vue
index e810a6b992..179bd49f0d 100644
--- a/src/client/pages/user/index.photos.vue
+++ b/src/client/pages/user/index.photos.vue
@@ -5,7 +5,7 @@
{{ $t('nothing') }}
@@ -15,6 +15,7 @@
diff --git a/src/client/pages/user/index.vue b/src/client/pages/user/index.vue
index a15d904194..ec342f1624 100644
--- a/src/client/pages/user/index.vue
+++ b/src/client/pages/user/index.vue
@@ -66,16 +66,16 @@
-
- {{ user.notesCount | number }}
+
+ {{ number(user.notesCount) }}
{{ $t('notes') }}
-
- {{ user.followingCount | number }}
+
+ {{ number(user.followingCount) }}
{{ $t('following') }}
-
- {{ user.followersCount | number }}
+
+ {{ number(user.followersCount) }}
{{ $t('followers') }}
@@ -119,6 +119,8 @@ import MkRemoteCaution from '../../components/remote-caution.vue';
import Progress from '../../scripts/loading';
import parseAcct from '../../../misc/acct/parse';
import { getScrollPosition } from '../../scripts/scroll';
+import number from '../../filters/number';
+import { userPage, acct } from '../../filters/user';
export default defineComponent({
components: {
@@ -133,7 +135,7 @@ export default defineComponent({
metaInfo() {
return {
- title: (this.user ? '@' + Vue.filter('acct')(this.user).replace('@', ' | ') : null) as string
+ title: (this.user ? '@' + acct(this.user).replace('@', ' | ') : null) as string
};
},
@@ -210,6 +212,10 @@ export default defineComponent({
const pos = -(top / z);
banner.style.backgroundPosition = `center calc(50% - ${pos}px)`;
},
+
+ number,
+
+ userPage
}
});
@@ -271,7 +277,7 @@ export default defineComponent({
background: rgba(0, 0, 0, 0.2);
padding: 8px;
border-radius: 24px;
-
+
> .menu {
vertical-align: bottom;
height: 31px;