Storage improve (#6976)

* wip

* wip

* wip

* wip

* wip

* Update storage.ts

* wip

* wip

* wip

* wip

* Update storage.ts

* Update storage.ts

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update storage.ts

* wip

* wip

* wip

* wip

* 🍕

* wip

* wip

* wip

* wip

* wip

* wip

* Update deck-storage.ts

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update store.ts

* wip

* wip

* wip

* wip

* Update init.ts

* wip

* wip

* Update pizzax.ts

* wip

* wip

* Update timeline.vue

* Update init.ts

* wip

* wip

* Update init.ts
This commit is contained in:
syuilo
2020-12-19 10:55:52 +09:00
committed by GitHub
parent 57d0c19a98
commit 43930e6a84
146 changed files with 1458 additions and 1519 deletions

View File

@@ -1,13 +1,13 @@
import { utils, values } from '@syuilo/aiscript';
import { store } from '@/store';
import * as os from '@/os';
import { $i } from '@/account';
export function createAiScriptEnv(opts) {
let apiRequests = 0;
return {
USER_ID: store.getters.isSignedIn ? values.STR(store.state.i.id) : values.NULL,
USER_NAME: store.getters.isSignedIn ? values.STR(store.state.i.name) : values.NULL,
USER_USERNAME: store.getters.isSignedIn ? values.STR(store.state.i.username) : values.NULL,
USER_ID: $i ? values.STR($i.id) : values.NULL,
USER_NAME: $i ? values.STR($i.name) : values.NULL,
USER_USERNAME: $i ? values.STR($i.username) : values.NULL,
'Mk:dialog': values.FN_NATIVE(async ([title, text, type]) => {
await os.dialog({
type: type ? type.value : 'info',

View File

@@ -5,11 +5,12 @@ import copyToClipboard from '@/scripts/copy-to-clipboard';
import { host } from '@/config';
import getAcct from '../../misc/acct/render';
import * as os from '@/os';
import { store, userActions } from '@/store';
import { userActions } from '@/store';
import { router } from '@/router';
import { $i } from '@/account';
export function getUserMenu(user) {
const meId = store.getters.isSignedIn ? store.state.i.id : null;
const meId = $i ? $i.id : null;
async function pushList() {
const t = i18n.global.t('selectList'); // なぜか後で参照すると null になるので最初にメモリに確保しておく
@@ -146,7 +147,7 @@ export function getUserMenu(user) {
action: inviteGroup
} : undefined] as any;
if (store.getters.isSignedIn && meId != user.id) {
if ($i && meId != user.id) {
menu = menu.concat([null, {
icon: user.isMuted ? faEye : faEyeSlash,
text: user.isMuted ? i18n.global.t('unmute') : i18n.global.t('mute'),
@@ -163,7 +164,7 @@ export function getUserMenu(user) {
action: reportAbuse
}]);
if (store.getters.isSignedIn && (store.state.i.isAdmin || store.state.i.isModerator)) {
if ($i && ($i.isAdmin || $i.isModerator)) {
menu = menu.concat([null, {
icon: faMicrophoneSlash,
text: user.isSilenced ? i18n.global.t('unsilence') : i18n.global.t('silence'),
@@ -176,7 +177,7 @@ export function getUserMenu(user) {
}
}
if (store.getters.isSignedIn && meId === user.id) {
if ($i && meId === user.id) {
menu = menu.concat([null, {
icon: faPencilAlt,
text: i18n.global.t('editProfile'),

View File

@@ -1,9 +1,9 @@
import { $i } from '@/account';
import { i18n } from '@/i18n';
import { dialog } from '@/os';
import { store } from '@/store';
export function pleaseLogin() {
if (store.getters.isSignedIn) return;
if ($i) return;
dialog({
title: i18n.global.t('signinRequired'),

View File

@@ -1,15 +1,15 @@
import { device } from '@/cold-storage';
import { ColdDeviceStorage } from '@/store';
const cache = new Map<string, HTMLAudioElement>();
export function play(type: string) {
const sound = device.get('sound_' + type as any);
const sound = ColdDeviceStorage.get('sound_' + type as any);
if (sound.type == null) return;
playFile(sound.type, sound.volume);
}
export function playFile(file: string, volume: number) {
const masterVolume = device.get('sound_masterVolume');
const masterVolume = ColdDeviceStorage.get('sound_masterVolume');
if (masterVolume === 0) return;
let audio: HTMLAudioElement;