last files transformed from js -> ts

This commit is contained in:
Rick van Lieshout 2023-05-07 16:13:30 +02:00
parent 53e4711c39
commit d823f07ed8
12 changed files with 22 additions and 28 deletions

View File

@ -1,6 +1,4 @@
const flags = { export const flags: { [key: string]: { flag: string; value?: any }[] } = {
gpuRasterization: [{ flag: "enable-gpu-rasterization", value: undefined }], gpuRasterization: [{ flag: "enable-gpu-rasterization", value: undefined }],
disableHardwareMediaKeys: [{ flag: "disable-features", value: "HardwareMediaKeyHandling" }], disableHardwareMediaKeys: [{ flag: "disable-features", value: "HardwareMediaKeyHandling" }],
}; };
module.exports = flags;

View File

@ -1,4 +1,4 @@
const globalEvents = { export const globalEvents = {
play: "play", play: "play",
pause: "pause", pause: "pause",
playPause: "playPause", playPause: "playPause",
@ -11,5 +11,3 @@ const globalEvents = {
storeChanged: "storeChanged", storeChanged: "storeChanged",
error: "error", error: "error",
}; };
module.exports = globalEvents;

View File

@ -1,9 +1,7 @@
const globalEvents = require("./globalEvents"); import { globalEvents } from "./globalEvents";
const mediaKeys = { export const mediaKeys = {
MediaPlayPause: globalEvents.playPause, MediaPlayPause: globalEvents.playPause,
MediaNextTrack: globalEvents.next, MediaNextTrack: globalEvents.next,
MediaPreviousTrack: globalEvents.previous, MediaPreviousTrack: globalEvents.previous,
}; };
module.exports = mediaKeys;

View File

@ -1,4 +1,4 @@
module.exports = { export const statuses = {
playing: "playing", playing: "playing",
paused: "paused", paused: "paused",
}; };

View File

@ -1,3 +1,3 @@
module.exports = { export default {
name: "tidal-hifi", name: "tidal-hifi",
}; };

View File

@ -9,9 +9,9 @@ import {
session, session,
} from "electron"; } from "electron";
import path from "path"; import path from "path";
import flagValues from "./constants/flags"; import { flags } from "./constants/flags";
import globalEvents from "./constants/globalEvents"; import { globalEvents } from "./constants/globalEvents";
import mediaKeys from "./constants/mediaKeys"; import { mediaKeys } from "./constants/mediaKeys";
import { initRPC, rpc, unRPC } from "./scripts/discord"; import { initRPC, rpc, unRPC } from "./scripts/discord";
import { startExpress } from "./scripts/express"; import { startExpress } from "./scripts/express";
import { updateMediaInfo } from "./scripts/mediaInfo"; import { updateMediaInfo } from "./scripts/mediaInfo";
@ -37,11 +37,11 @@ const PROTOCOL_PREFIX = "tidal";
setFlags(); setFlags();
function setFlags() { function setFlags() {
const flags = settingsStore.get(settings.flags.root); const flagsFromSettings = settingsStore.get(settings.flags.root);
if (flags) { if (flagsFromSettings) {
for (const [key, value] of Object.entries(flags)) { for (const [key, value] of Object.entries(flags)) {
if (value) { if (value) {
(flagValues as any)[key].forEach((flag: any) => { flags[key].forEach((flag) => {
console.log(`enabling command line switch ${flag.flag} with value ${flag.value}`); console.log(`enabling command line switch ${flag.flag} with value ${flag.value}`);
app.commandLine.appendSwitch(flag.flag, flag.value); app.commandLine.appendSwitch(flag.flag, flag.value);
}); });

View File

@ -1,6 +1,6 @@
import remote from "@electron/remote"; import remote from "@electron/remote";
import { ipcRenderer, shell } from "electron"; import { ipcRenderer, shell } from "electron";
import globalEvents from "../../constants/globalEvents"; import { globalEvents } from "../../constants/globalEvents";
import { settings } from "../../constants/settings"; import { settings } from "../../constants/settings";
import { settingsStore } from "./../../scripts/settings"; import { settingsStore } from "./../../scripts/settings";

View File

@ -1,15 +1,15 @@
import { Notification, app, dialog } from "@electron/remote"; import { Notification, app, dialog } from "@electron/remote";
import { ipcRenderer } from "electron"; import { ipcRenderer } from "electron";
import Player from "mpris-service"; import Player from "mpris-service";
import globalEvents from "./constants/globalEvents"; import { globalEvents } from "./constants/globalEvents";
import { settings } from "./constants/settings"; import { settings } from "./constants/settings";
import statuses from "./constants/statuses"; import { statuses } from "./constants/statuses";
import { Options } from "./models/options"; import { Options } from "./models/options";
import { downloadFile } from "./scripts/download"; import { downloadFile } from "./scripts/download";
import { addHotkey } from "./scripts/hotkeys"; import { addHotkey } from "./scripts/hotkeys";
import { setTitle } from "./scripts/window-functions";
import { settingsStore } from "./scripts/settings"; import { settingsStore } from "./scripts/settings";
import { setTitle } from "./scripts/window-functions";
const notificationPath = `${app.getPath("userData")}/notification.jpg`; const notificationPath = `${app.getPath("userData")}/notification.jpg`;
const appName = "Tidal Hifi"; const appName = "Tidal Hifi";
let currentSong = ""; let currentSong = "";

View File

@ -1,6 +1,6 @@
import { Client } from "discord-rpc"; import { Client } from "discord-rpc";
import { app, ipcMain } from "electron"; import { app, ipcMain } from "electron";
import globalEvents from "../constants/globalEvents"; import { globalEvents } from "../constants/globalEvents";
import { MediaStatus } from "../models/mediaStatus"; import { MediaStatus } from "../models/mediaStatus";
import { mediaInfo } from "./mediaInfo"; import { mediaInfo } from "./mediaInfo";

View File

@ -1,8 +1,8 @@
import { BrowserWindow, dialog } from "electron"; import { BrowserWindow, dialog } from "electron";
import express, { Response } from "express"; import express, { Response } from "express";
import fs from "fs"; import fs from "fs";
import globalEvents from "./../constants/globalEvents"; import { globalEvents } from "./../constants/globalEvents";
import statuses from "./../constants/statuses"; import { statuses } from "./../constants/statuses";
import { mediaInfo } from "./mediaInfo"; import { mediaInfo } from "./mediaInfo";
import { settingsStore } from "./settings"; import { settingsStore } from "./settings";
import { settings } from "../constants/settings"; import { settings } from "../constants/settings";

View File

@ -1,5 +1,5 @@
import { MediaInfo } from "../models/mediaInfo"; import { MediaInfo } from "../models/mediaInfo";
import statuses from "./../constants/statuses"; import { statuses } from "./../constants/statuses";
export const mediaInfo = { export const mediaInfo = {
title: "", title: "",

View File

@ -1,7 +1,7 @@
import { BrowserWindow, Menu, app } from "electron"; import { BrowserWindow, Menu, app } from "electron";
const { showSettingsWindow } = require("./settings"); import { showSettingsWindow } from "./settings";
const isMac = process.platform === "darwin"; const isMac = process.platform === "darwin";
const { name } = require("./../constants/values"); import name from "./../constants/values";
const settingsMenuEntry = { const settingsMenuEntry = {
label: "Settings", label: "Settings",