last files transformed from js -> ts

This commit is contained in:
Rick van Lieshout 2023-05-07 16:13:30 +02:00
parent 21d6e57cb9
commit a1c02dfed3
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 }],
disableHardwareMediaKeys: [{ flag: "disable-features", value: "HardwareMediaKeyHandling" }],
};
module.exports = flags;

View File

@ -1,4 +1,4 @@
const globalEvents = {
export const globalEvents = {
play: "play",
pause: "pause",
playPause: "playPause",
@ -11,5 +11,3 @@ const globalEvents = {
storeChanged: "storeChanged",
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,
MediaNextTrack: globalEvents.next,
MediaPreviousTrack: globalEvents.previous,
};
module.exports = mediaKeys;

View File

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

View File

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

View File

@ -9,9 +9,9 @@ import {
session,
} from "electron";
import path from "path";
import flagValues from "./constants/flags";
import globalEvents from "./constants/globalEvents";
import mediaKeys from "./constants/mediaKeys";
import { flags } from "./constants/flags";
import { globalEvents } from "./constants/globalEvents";
import { mediaKeys } from "./constants/mediaKeys";
import { initRPC, rpc, unRPC } from "./scripts/discord";
import { startExpress } from "./scripts/express";
import { updateMediaInfo } from "./scripts/mediaInfo";
@ -37,11 +37,11 @@ const PROTOCOL_PREFIX = "tidal";
setFlags();
function setFlags() {
const flags = settingsStore.get(settings.flags.root);
if (flags) {
const flagsFromSettings = settingsStore.get(settings.flags.root);
if (flagsFromSettings) {
for (const [key, value] of Object.entries(flags)) {
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}`);
app.commandLine.appendSwitch(flag.flag, flag.value);
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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