mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-02 09:46:06 +02:00
refactor(frontend): ID生成処理を統一
This commit is contained in:
@@ -29,6 +29,7 @@ import MkContainer from '@/components/MkContainer.vue';
|
||||
import { aiScriptReadline, createAiScriptEnv } from '@/aiscript/api.js';
|
||||
import { $i } from '@/i.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { genId } from '@/utility/id.js';
|
||||
|
||||
const name = 'aiscript';
|
||||
|
||||
@@ -73,7 +74,7 @@ const run = async () => {
|
||||
in: aiScriptReadline,
|
||||
out: (value) => {
|
||||
logs.value.push({
|
||||
id: Math.random().toString(),
|
||||
id: genId(),
|
||||
text: value.type === 'str' ? value.value : utils.valToString(value),
|
||||
print: true,
|
||||
});
|
||||
@@ -81,7 +82,7 @@ const run = async () => {
|
||||
log: (type, params) => {
|
||||
switch (type) {
|
||||
case 'end': logs.value.push({
|
||||
id: Math.random().toString(),
|
||||
id: genId(),
|
||||
text: utils.valToString(params.val, true),
|
||||
print: false,
|
||||
}); break;
|
||||
|
||||
@@ -60,6 +60,7 @@ import kmg from '@/filters/kmg.js';
|
||||
import * as sound from '@/utility/sound.js';
|
||||
import { deepClone } from '@/utility/clone.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { genId } from '@/utility/id.js';
|
||||
|
||||
const name = 'jobQueue';
|
||||
|
||||
@@ -144,7 +145,7 @@ connection.on('stats', onStats);
|
||||
connection.on('statsLog', onStatsLog);
|
||||
|
||||
connection.send('requestLog', {
|
||||
id: Math.random().toString().substring(2, 10),
|
||||
id: genId(),
|
||||
length: 1,
|
||||
});
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ onMounted(() => {
|
||||
props.connection.on('stats', onStats);
|
||||
props.connection.on('statsLog', onStatsLog);
|
||||
props.connection.send('requestLog', {
|
||||
id: Math.random().toString().substring(2, 10),
|
||||
id: genId(),
|
||||
length: 50,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,6 +52,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
import { onMounted, onBeforeUnmount, ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import bytes from '@/filters/bytes.js';
|
||||
import { genId } from '@/utility/id.js';
|
||||
|
||||
const props = defineProps<{
|
||||
connection: Misskey.ChannelConnection<Misskey.Channels['serverStats']>,
|
||||
@@ -76,7 +77,7 @@ onMounted(() => {
|
||||
props.connection.on('stats', onStats);
|
||||
props.connection.on('statsLog', onStatsLog);
|
||||
props.connection.send('requestLog', {
|
||||
id: Math.random().toString().substring(2, 10),
|
||||
id: genId(),
|
||||
length: 50,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user