Skip to content

Commit

Permalink
BASE_URLが/では無い時にデフォルトアラームが流れない問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreNion committed Dec 13, 2023
1 parent 5d74eab commit ca06c3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ useHead({
],
});
defaultAlertAudioSource().value = `${useRuntimeConfig().app.baseURL}alert.mp3`;
onMounted(async () => {
try {
// スリープを無効化
Expand Down
2 changes: 1 addition & 1 deletion components/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const removeAudio = (fileName: string, sourceState: globalThis.Ref<string>, stor
// メモリ上の音源/名前を元に戻す
fileNameState.value = 'デフォルトの音声';
sourceState.value = "/alert.mp3";
sourceState.value = defaultAlertAudioSource().value;
}
const onAlertAudioChange = async (e: Event) => {
Expand Down
10 changes: 7 additions & 3 deletions composables/states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ export const time = () => useState<Date>('time', () => dayjs().toDate());

// 現在のセンサー情報のソース
export const sensorSource = () => useState<string>('sensorSource', () => "rpi");

// alert.mp3のソース
export const defaultAlertAudioSource = () => useState<string>('defaultAlertAudioSource', () => '/alert.mp3');

// タイマーの音声のソース
export const timerAlertSource = () => useState<string>('timerSource', () => "/alert.mp3");
export const timerAlertSource = () => useState<string>('timerSource', () => defaultAlertAudioSource().value);
// チャイムの音声ソース
export const chimeSource = () => useState<string>('chimeSource', () => "/alert.mp3");
export const chimeSource = () => useState<string>('chimeSource', () => defaultAlertAudioSource().value);
// 予鈴の音声ソース
export const preChimeSource = () => useState<string>('preChimeSource', () => "/alert.mp3");
export const preChimeSource = () => useState<string>('preChimeSource', () => defaultAlertAudioSource().value);

// タイマーのインターバル
export const interval = () => useState<Pausable | null>('interval', () => null);
Expand Down

0 comments on commit ca06c3b

Please sign in to comment.