Compare commits

..

No commits in common. "a0a90f24280438e97e64865fcd3f392b11c22d42" and "497c73725cc1683d7d085bbaee94a7e1340a5a9b" have entirely different histories.

14 changed files with 20 additions and 47 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -2,7 +2,8 @@
"appId": "com.alikia2x.openrewind",
"mac": {
"category": "public.app-category.productivity",
"target": "dmg"
"target": "dmg",
"files": ["bin/macos"]
},
"productName": "OpenRewind",
"directories": {

View File

@ -1,6 +1,6 @@
{
"name": "openrewind",
"version": "0.8.0",
"version": "0.6.0",
"type": "module",
"description": "Your second brain, superpowered.",
"main": "dist/electron/index.js",
@ -41,7 +41,6 @@
"image-size": "^1.1.1",
"jotai": "^2.11.0",
"memory-cache": "^0.2.0",
"pino": "^9.6.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^15.1.2",

View File

@ -4,8 +4,8 @@ import fs from "fs";
import path, { join } from "path";
import type { EncodingTask, Frame } from "./schema";
import sizeOf from "image-size";
import { getEncodeCommand } from "../utils/index.js";
import { getRecordingsDir, getEncodingTempDir, getScreenshotsDir } from "../utils/index.js";
import { getEncodeCommand } from "../utils/video/index.js";
import { getRecordingsDir, getEncodingTempDir, getScreenshotsDir } from "../utils/fs/index.js";
import cache from "memory-cache";
import { ENCODING_FRAME_INTERVAL, RECORD_FRAME_RATE as FRAME_RATE } from "./consts.js";

View File

@ -2,7 +2,7 @@ import * as path from "path";
import { Database } from "better-sqlite3";
import DB from "better-sqlite3";
import { __dirname } from "../dirname.js";
import { getDatabaseDir } from "../utils/index.js";
import { getDatabaseDir } from "../utils/fs/index.js";
import { migrate } from "./migrate/index.js";
function getLibSimpleExtensionPath() {

View File

@ -1,5 +1,5 @@
import screenshot from "screenshot-desktop";
import { getScreenshotsDir } from "../utils/index.js";
import { getScreenshotsDir } from "../utils/fs/index.js";
import { join } from "path";
import { Database } from "better-sqlite3";
import SqlString from "sqlstring";

View File

@ -2,7 +2,7 @@ import { app, BrowserWindow, screen } from "electron";
import { join } from "path";
import { __dirname } from "./dirname.js";
import windowStateManager from "electron-window-state";
import { hideDock, showDock } from "./utils/index.js";
import { hideDock, showDock } from "./utils/platform/index.js";
function loadURL(window: BrowserWindow, path = "", vitePort: string) {
const dev = !app.isPackaged;

View File

@ -16,7 +16,7 @@ import { initDatabase } from "./backend/init.js";
import { Database } from "better-sqlite3";
import { startScreenshotLoop } from "./backend/screenshot.js";
import { __dirname } from "./dirname.js";
import { hideDock } from "./utils/index.js";
import { hideDock } from "./utils/platform/index.js";
import {
checkFramesForEncoding,
deleteUnnecessaryScreenshots,
@ -24,7 +24,7 @@ import {
} from "./backend/encoding.js";
import honoApp from "./server/index.js";
import { serve } from "@hono/node-server";
import { findAvailablePort } from "./utils/index.js";
import { findAvailablePort } from "./utils/network/index.js";
import cache from "memory-cache";
import { generate as generateAPIKey } from "@alikia/random-key";

View File

@ -10,8 +10,8 @@ import {
getRecordingsDir,
getScreenshotsDir,
waitForFileExists
} from "../utils/index.js";
import { immediatelyExtractFrameFromVideo } from "../utils/index.js";
} from "../utils/fs/index.js";
import { immediatelyExtractFrameFromVideo } from "../utils/video/index.js";
import { existsSync } from "fs";
const app = new Hono();

View File

@ -59,15 +59,6 @@ export function getDecodingTempDir() {
return decodingTempDir;
}
export function getLogDir() {
const dataDir = createDataDir();
const logDir = path.join(dataDir, "logs");
if (!fs.existsSync(logDir)) {
fs.mkdirSync(logDir, { recursive: true });
}
return logDir;
}
export async function waitForFileExists(filePath: string, timeout: number = 10000): Promise<void> {
return new Promise((resolve, reject) => {
fs.access(filePath, fs.constants.F_OK, (err) => {

View File

@ -2,4 +2,3 @@ export * from "./fs/index.js";
export * from "./platform/index.js";
export * from "./video/index.js";
export * from "./network/index.js";
export * from "./logging/index.js";

View File

@ -1,10 +0,0 @@
import pino from "pino";
import { join } from "path";
import { getLogDir } from "../fs/index.js";
const logPath = join(getLogDir(), "log.json");
const dest = pino.destination(logPath);
const logger = pino(dest);
export { logger };

View File

@ -1,15 +1,14 @@
import { join } from "path";
import path from "path";
import os from "os";
import { app } from "electron";
import { __dirname } from "../../dirname.js";
import { logger } from "../index.js";
export function getUserDataDir() {
switch (process.platform) {
case "win32":
return join(process.env.APPDATA!, "OpenRewind", "Record Data");
return path.join(process.env.APPDATA!, "OpenRewind", "Record Data");
case "darwin":
return join(
return path.join(
os.homedir(),
"Library",
"Application Support",
@ -17,7 +16,7 @@ export function getUserDataDir() {
"Record Data"
);
case "linux":
return join(os.homedir(), ".config", "OpenRewind", "Record Data");
return path.join(os.homedir(), ".config", "OpenRewind", "Record Data");
default:
throw new Error("Unsupported platform");
}
@ -38,20 +37,14 @@ export function showDock() {
}
export function getFFmpegPath() {
let path = "";
switch (process.platform) {
case "win32":
path = join(__dirname, "bin", process.platform, "ffmpeg.exe");
break;
return path.join(__dirname, "bin", process.platform, "ffmpeg.exe");
case "darwin":
path = join(__dirname, "bin", process.platform, "ffmpeg");
break;
return path.join(__dirname, "bin", process.platform, "ffmpeg");
case "linux":
path = join(__dirname, "bin", process.platform, "ffmpeg");
break;
return path.join(__dirname, "bin", process.platform, "ffmpeg");
default:
throw new Error("Unsupported platform");
}
logger.info("FFmpeg path: %s", path);
return path;
}

View File

@ -44,7 +44,7 @@ export function immediatelyExtractFrameFromVideo(
"1",
`${outputPathArg}`
];
const ffmpeg = spawn(getFFmpegPath(), args);
const ffmpeg = spawn("ffmpeg", args);
ffmpeg.stdout.on("data", (data) => {
console.log(data.toString());
});