ref: format
This commit is contained in:
parent
bc0483cdc8
commit
d2899d4b50
@ -7,13 +7,21 @@ export default function IconWithText() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex">
|
||||
<img src={imgUrl} className="h-20 w-20 mr-2" alt="OpenRewind icon"/>
|
||||
<img src={imgUrl} className="h-20 w-20 mr-2" alt="OpenRewind icon" />
|
||||
<div className="flex flex-col justify-start w-auto h-[4.2rem] overflow-hidden mt-1">
|
||||
<span className="text-2xl font-semibold">OpenRewind</span>
|
||||
<span className="text-sm text-gray-700 dark:text-gray-200
|
||||
font-medium ml-0.5">{t("settings.version", { version: pjson.version })}</span>
|
||||
<span className="text-xs text-gray-700 dark:text-gray-200
|
||||
font-medium ml-0.5">{t("settings.copyright")}</span>
|
||||
<span
|
||||
className="text-sm text-gray-700 dark:text-gray-200
|
||||
font-medium ml-0.5"
|
||||
>
|
||||
{t("settings.version", { version: pjson.version })}
|
||||
</span>
|
||||
<span
|
||||
className="text-xs text-gray-700 dark:text-gray-200
|
||||
font-medium ml-0.5"
|
||||
>
|
||||
{t("settings.copyright")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -1,10 +1,14 @@
|
||||
import { MouseEventHandler } from "react";
|
||||
import { Icon } from "@iconify-icon/react";
|
||||
|
||||
const MenuItem = ({ icon, text, onClick }: {
|
||||
icon: string,
|
||||
text: string,
|
||||
onClick: MouseEventHandler<HTMLDivElement>
|
||||
const MenuItem = ({
|
||||
icon,
|
||||
text,
|
||||
onClick
|
||||
}: {
|
||||
icon: string;
|
||||
text: string;
|
||||
onClick: MouseEventHandler<HTMLDivElement>;
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
|
@ -7,10 +7,8 @@ export default function OpenSourceNote() {
|
||||
OpenRewind is open source software licensed under
|
||||
<a href="https://www.gnu.org/licenses/gpl-3.0.html">GPL 3.0</a>.<br />
|
||||
Source code is avaliable at
|
||||
<a href="https://github.com/alikia2x/openrewind">
|
||||
GitHub
|
||||
</a>.
|
||||
<a href="https://github.com/alikia2x/openrewind">GitHub</a>.
|
||||
</Trans>
|
||||
</p>
|
||||
)
|
||||
);
|
||||
}
|
@ -1,9 +1,15 @@
|
||||
import * as React from "react";
|
||||
import { useRef } from "react";
|
||||
|
||||
const SettingsGroup = (
|
||||
{ children, groupName, addGroupRef }:
|
||||
{ children: React.ReactNode, groupName: string, addGroupRef: Function }) => {
|
||||
const SettingsGroup = ({
|
||||
children,
|
||||
groupName,
|
||||
addGroupRef
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
groupName: string;
|
||||
addGroupRef: Function;
|
||||
}) => {
|
||||
const groupRef = useRef(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
@ -2,9 +2,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
const Title = ({ i18nKey }: { i18nKey: string }) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<h1 className="text-3xl font-bold leading-[3rem]">{t(i18nKey)}</h1>
|
||||
);
|
||||
}
|
||||
return <h1 className="text-3xl font-bold leading-[3rem]">{t(i18nKey)}</h1>;
|
||||
};
|
||||
|
||||
export default Title;
|
@ -22,7 +22,10 @@ ALTER TABLE encoding_task RENAME COLUMN createAt TO createdAt;
|
||||
The `createdAt` column was updated to store Unix timestamps instead of formatted timestamps.
|
||||
|
||||
```typescript
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM encoding_task`).all() as { [x: string]: unknown; id: unknown; }[];
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM encoding_task`).all() as {
|
||||
[x: string]: unknown;
|
||||
id: unknown;
|
||||
}[];
|
||||
const updateStmt = db.prepare(`UPDATE encoding_task SET createdAt_new = ? WHERE id = ?`);
|
||||
rows.forEach((row) => {
|
||||
const unixTimestamp = convertTimestampToUnix(row.createdAt as string);
|
||||
@ -45,7 +48,10 @@ ALTER TABLE frame RENAME COLUMN createAt TO createdAt;
|
||||
The `createdAt` column was updated to store Unix timestamps instead of formatted timestamps.
|
||||
|
||||
```typescript
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM frame`).all() as { [x: string]: unknown; id: unknown; }[];
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM frame`).all() as {
|
||||
[x: string]: unknown;
|
||||
id: unknown;
|
||||
}[];
|
||||
const updateStmt = db.prepare(`UPDATE frame SET createdAt_new = ? WHERE id = ?`);
|
||||
rows.forEach((row) => {
|
||||
const unixTimestamp = convertTimestampToUnix(row.createdAt as string);
|
||||
@ -69,7 +75,10 @@ ALTER TABLE segments RENAME COLUMN endAt TO endedAt;
|
||||
The `startedAt` and `endedAt` columns were updated to store Unix timestamps instead of formatted timestamps.
|
||||
|
||||
```typescript
|
||||
const rows = db.prepare(`SELECT id, startedAt, endedAt FROM segments`).all() as { [x: string]: unknown; id: unknown; }[];
|
||||
const rows = db.prepare(`SELECT id, startedAt, endedAt FROM segments`).all() as {
|
||||
[x: string]: unknown;
|
||||
id: unknown;
|
||||
}[];
|
||||
const updateStart = db.prepare(`UPDATE segments SET startedAt_new = ? WHERE id = ?`);
|
||||
const updateEnd = db.prepare(`UPDATE segments SET endedAt_new = ? WHERE id = ?`);
|
||||
rows.forEach((row) => {
|
||||
@ -108,7 +117,7 @@ Corresponding version: 0.4.0
|
||||
Stores configuration data, including the database version.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------|-----------|---------------------|-----------------------------------------------------------------------------|
|
||||
| ----------- | --------- | ------------------- | -------------------------------------- |
|
||||
| `key` | TEXT | PRIMARY KEY | Unique key for configuration settings. |
|
||||
| `value` | TEXT | | Value associated with the key. |
|
||||
|
||||
@ -123,7 +132,7 @@ INSERT INTO config (key, value) VALUES ('version', '2');
|
||||
Stores encoding tasks that are queued for processing.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------|-----------|----------------------------|--------------------------------------|
|
||||
| ----------- | --------- | -------------------------- | ------------------------------------ |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique ID for the task. |
|
||||
| `createAt` | TIMESTAMP | DEFAULT CURRENT_TIMESTAMP | Timestamp when the task was created. |
|
||||
| `status` | INTEGER | DEFAULT 0 | Indicates the status of the task. |
|
||||
@ -158,11 +167,10 @@ END;
|
||||
Stores the frames that need to be encoded for the encoding task
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|------------------|-----------|-------------------------------------|------------------------------------------------------|
|
||||
| ---------------- | --------- | ----------------------------------- | ---------------------------------------------------- |
|
||||
| `frame` | INTEGER | PRIMARY KEY, FOREIGN KEY (frame.id) | ID for the frame associated with the encoding task. |
|
||||
| `encodingTaskID` | TIMESTAMP | FOREIGN KEY (encoding_task.id) | ID for the encoding task associated with this frame. |
|
||||
|
||||
|
||||
### Update `frame` Table
|
||||
|
||||
#### Simplify `imgFilename`
|
||||
@ -170,11 +178,11 @@ Stores the frames that need to be encoded for the encoding task
|
||||
The `imgFilename` column was updated to store only the filename without the full path.
|
||||
|
||||
```typescript
|
||||
const rows = db.prepare('SELECT id, imgFilename FROM frame').all() as OldFrame[];
|
||||
rows.forEach(row => {
|
||||
const rows = db.prepare("SELECT id, imgFilename FROM frame").all() as OldFrame[];
|
||||
rows.forEach((row) => {
|
||||
const filename = row.imgFilename.match(/[^\\/]+$/)?.[0];
|
||||
if (filename) {
|
||||
db.prepare('UPDATE frame SET imgFilename = ? WHERE id = ?').run(filename, row.id);
|
||||
db.prepare("UPDATE frame SET imgFilename = ? WHERE id = ?").run(filename, row.id);
|
||||
}
|
||||
});
|
||||
```
|
||||
@ -198,7 +206,6 @@ UPDATE frame SET encodeStatus = CASE WHEN encoded THEN 2 ELSE 0 END;
|
||||
- The `encoded` column is no longer used and is retained due to SQLite's inability to drop columns.
|
||||
Creating a new table without this column and copying data to the new table could be time-consuming.
|
||||
|
||||
|
||||
## Version 1 Schema
|
||||
|
||||
Corresponding version: 0.3.x
|
||||
@ -208,7 +215,7 @@ Corresponding version: 0.3.x
|
||||
Stores information about individual frames.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------------|-----------|---------------------------------|-------------------------------------------------------------------------|
|
||||
| ----------------- | --------- | ------------------------------- | ----------------------------------------------------------------------- |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique identifier for each frame. |
|
||||
| `createAt` | TIMESTAMP | DEFAULT CURRENT_TIMESTAMP | Timestamp when the frame was created. |
|
||||
| `imgFilename` | TEXT | | Filename of the image associated with the frame. |
|
||||
@ -223,7 +230,7 @@ Stores information about individual frames.
|
||||
Stores recognition data associated with frames.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Desc[database-structure.md](database-structure.md)ription |
|
||||
|-------------|-----------|----------------------------|-----------------------------------------------------------|
|
||||
| ----------- | --------- | -------------------------- | --------------------------------------------------------- |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique identifier for each recognition data entry. |
|
||||
| `frameID` | INTEGER | FOREIGN KEY (frame.id) | ID of the frame to which the recognition data belongs. |
|
||||
| `data` | TEXT | | Raw recognition data. |
|
||||
@ -236,7 +243,7 @@ While capturing the screen, OpenRewind retrieves the currently active window.
|
||||
When it finds that the currently active window has changed to another application, a new segment will start.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|---------------|-----------|----------------------------|------------------------------------------------------|
|
||||
| ------------- | --------- | -------------------------- | ---------------------------------------------------- |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique identifier for each segment. |
|
||||
| `startAt` | TIMESTAMP | | Timestamp when the segment starts. |
|
||||
| `endAt` | TIMESTAMP | | Timestamp when the segment ends. |
|
||||
@ -253,7 +260,7 @@ When it finds that the currently active window has changed to another applicatio
|
||||
Used for full-text search on recognition data.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------|-----------|---------------------|--------------------------------------------------------|
|
||||
| ----------- | --------- | ------------------- | ------------------------------------------------------ |
|
||||
| `id` | INTEGER | UNINDEXED | ID of the recognition data entry. |
|
||||
| `frameID` | INTEGER | UNINDEXED | ID of the frame to which the recognition data belongs. |
|
||||
| `data` | TEXT | | Raw recognition data. |
|
||||
|
@ -7,7 +7,7 @@ This document outlines the current structure of the database schema used in the
|
||||
Stores configuration data.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------|-----------|---------------------|-----------------------------------------------------------------------------|
|
||||
| ----------- | --------- | ------------------- | -------------------------------------- |
|
||||
| `key` | TEXT | PRIMARY KEY | Unique key for configuration settings. |
|
||||
| `value` | TEXT | | Value associated with the key. |
|
||||
|
||||
@ -20,7 +20,7 @@ The current database schema version, represented as an integer. Since the `confi
|
||||
Stores information about individual frames.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------------|-----------|---------------------------------|-----------------------------------------------------------|
|
||||
| ----------------- | --------- | ------------------------------- | --------------------------------------------------------- |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique identifier for each frame. |
|
||||
| `createdAt` | REAL | | Timestamp when the frame was created. |
|
||||
| `imgFilename` | TEXT | | Filename of the image associated with the frame. |
|
||||
@ -41,7 +41,7 @@ Stores information about individual frames.
|
||||
Stores recognition data associated with frames.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------|-----------|------------------------------|-----------------------------------------------------------------------------|
|
||||
| ----------- | --------- | -------------------------- | ------------------------------------------------------ |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique identifier for each recognition data entry. |
|
||||
| `frameID` | INTEGER | FOREIGN KEY (frame.id) | ID of the frame to which the recognition data belongs. |
|
||||
| `data` | TEXT | | Raw recognition data. |
|
||||
@ -52,7 +52,7 @@ Stores recognition data associated with frames.
|
||||
A segment is a period of time when a user uses a particular application. While capturing the screen, OpenRewind detects the currently active window. When it finds that the currently active window has changed to another application, a new segment will start.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|---------------|-----------|----------------------------|------------------------------------------------------|
|
||||
| ------------- | --------- | -------------------------- | ---------------------------------------------------- |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique identifier for each segment. |
|
||||
| `startedAt` | REAL | | Timestamp when the segment starts. |
|
||||
| `endedAt` | REAL | | Timestamp when the segment ends. |
|
||||
@ -69,7 +69,7 @@ A segment is a period of time when a user uses a particular application. While c
|
||||
Stores encoding tasks that are queued for processing.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------|-----------|----------------------------|--------------------------------------|
|
||||
| ----------- | --------- | -------------------------- | ------------------------------------ |
|
||||
| `id` | INTEGER | PRIMARY KEY, AUTOINCREMENT | Unique ID for the task. |
|
||||
| `createdAt` | REAL | | Timestamp when the task was created. |
|
||||
| `status` | INTEGER | DEFAULT 0 | Indicates the status of the task. |
|
||||
@ -86,7 +86,7 @@ Stores encoding tasks that are queued for processing.
|
||||
Stores the frames that need to be encoded for the encoding task.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|------------------|-----------|-------------------------------------|------------------------------------------------------|
|
||||
| ---------------- | --------- | ----------------------------------- | ---------------------------------------------------- |
|
||||
| `encodingTaskID` | INTEGER | FOREIGN KEY (encoding_task.id) | ID for the encoding task associated with this frame. |
|
||||
| `frame` | INTEGER | PRIMARY KEY, FOREIGN KEY (frame.id) | ID for the frame associated with the encoding task. |
|
||||
|
||||
@ -95,7 +95,7 @@ Stores the frames that need to be encoded for the encoding task.
|
||||
Used for full-text search on recognition data.
|
||||
|
||||
| Column Name | Data Type | Constraints/Default | Description |
|
||||
|-------------|-----------|---------------------|--------------------------------------------------------|
|
||||
| ----------- | --------- | ------------------- | ------------------------------------------------------ |
|
||||
| `id` | INTEGER | UNINDEXED | ID of the recognition data entry. |
|
||||
| `frameID` | INTEGER | UNINDEXED | ID of the frame to which the recognition data belongs. |
|
||||
| `data` | TEXT | | Raw recognition data. |
|
||||
|
@ -3,9 +3,7 @@
|
||||
"mac": {
|
||||
"category": "public.app-category.productivity",
|
||||
"target": "dmg",
|
||||
"files": [
|
||||
"bin/macos"
|
||||
]
|
||||
"files": ["bin/macos"]
|
||||
},
|
||||
"productName": "OpenRewind",
|
||||
"directories": {
|
||||
@ -20,9 +18,7 @@
|
||||
],
|
||||
"win": {
|
||||
"target": "nsis",
|
||||
"files": [
|
||||
"bin/win32"
|
||||
]
|
||||
"files": ["bin/win32"]
|
||||
},
|
||||
"linux": {
|
||||
"target": "AppImage"
|
||||
|
39
gulpfile.ts
39
gulpfile.ts
@ -4,42 +4,37 @@ import ts from "gulp-typescript";
|
||||
import clean from "gulp-clean";
|
||||
import fs from "fs";
|
||||
|
||||
const tsProject = ts.createProject('tsconfig.json');
|
||||
const tsProject = ts.createProject("tsconfig.json");
|
||||
|
||||
gulp.task('clean', function () {
|
||||
return gulp.src('dist/electron', {read: false, allowEmpty: true})
|
||||
.pipe(clean());
|
||||
gulp.task("clean", function () {
|
||||
return gulp.src("dist/electron", { read: false, allowEmpty: true }).pipe(clean());
|
||||
});
|
||||
|
||||
gulp.task('scripts', () => {
|
||||
gulp.task("scripts", () => {
|
||||
if (!fs.existsSync("dist/electron")) {
|
||||
fs.mkdirSync("dist/electron", { recursive: true });
|
||||
}
|
||||
const tsResult = tsProject.src()
|
||||
.pipe(tsProject());
|
||||
const tsResult = tsProject.src().pipe(tsProject());
|
||||
|
||||
const jsFiles = gulp.src(['src/electron/**/*.js', 'src/electron/**/*.cjs']);
|
||||
const jsFiles = gulp.src(["src/electron/**/*.js", "src/electron/**/*.cjs"]);
|
||||
|
||||
return tsResult.js
|
||||
.pipe(gulp.dest('dist/electron'))
|
||||
.on('end', () => {
|
||||
jsFiles.pipe(gulp.dest('dist/electron'));
|
||||
return tsResult.js.pipe(gulp.dest("dist/electron")).on("end", () => {
|
||||
jsFiles.pipe(gulp.dest("dist/electron"));
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('assets', () => {
|
||||
return gulp.src('src/electron/assets/**/*', { encoding: false })
|
||||
.pipe(gulp.dest('dist/electron/assets'));
|
||||
gulp.task("assets", () => {
|
||||
return gulp
|
||||
.src("src/electron/assets/**/*", { encoding: false })
|
||||
.pipe(gulp.dest("dist/electron/assets"));
|
||||
});
|
||||
|
||||
gulp.task('binary', () => {
|
||||
return gulp.src('bin/**/*', { encoding: false })
|
||||
.pipe(gulp.dest('dist/electron/bin'));
|
||||
gulp.task("binary", () => {
|
||||
return gulp.src("bin/**/*", { encoding: false }).pipe(gulp.dest("dist/electron/bin"));
|
||||
});
|
||||
|
||||
gulp.task("locales", () => {
|
||||
return gulp.src('i18n/**/*')
|
||||
.pipe(gulp.dest('dist/electron/i18n'));
|
||||
})
|
||||
return gulp.src("i18n/**/*").pipe(gulp.dest("dist/electron/i18n"));
|
||||
});
|
||||
|
||||
gulp.task('build', gulp.series('clean', 'scripts', 'assets', 'binary', 'locales'));
|
||||
gulp.task("build", gulp.series("clean", "scripts", "assets", "binary", "locales"));
|
||||
|
@ -11,7 +11,8 @@
|
||||
"dev:electron": "bunx gulp build && electron dist/electron/index.js",
|
||||
"build:react": "vite build",
|
||||
"build:app": "bunx gulp build",
|
||||
"build:electron": "electron-builder"
|
||||
"build:electron": "electron-builder",
|
||||
"format": "bunx prettier --write ."
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
@ -1,12 +1,9 @@
|
||||
import "./index.css";
|
||||
|
||||
export default function RewindPage() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="w-screen h-screen relative dark:text-white">
|
||||
|
||||
</div>
|
||||
<div className="w-screen h-screen relative dark:text-white"></div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
user-select: none;
|
||||
}
|
||||
#settings-note a {
|
||||
@apply text-blue-700 dark:text-[#66ccff]
|
||||
@apply text-blue-700 dark:text-[#66ccff];
|
||||
}
|
||||
|
||||
.text-weaken {
|
||||
|
@ -36,7 +36,7 @@ function TitleBar() {
|
||||
<div
|
||||
className="z-50 absolute right-2.5 top-2.5 bg-red-500 hover:bg-rose-400 h-3 w-3 rounded-full"
|
||||
onClick={() => {
|
||||
console.log(window.settingsWindow)
|
||||
console.log(window.settingsWindow);
|
||||
window.settingsWindow.close();
|
||||
}}
|
||||
>
|
||||
|
@ -19,8 +19,10 @@ function getLibSimpleExtensionPath() {
|
||||
}
|
||||
|
||||
function databaseInitialized(db: Database) {
|
||||
return db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='frame';`).get()
|
||||
!== undefined;
|
||||
return (
|
||||
db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='frame';`).get() !==
|
||||
undefined
|
||||
);
|
||||
}
|
||||
|
||||
function init(db: Database) {
|
||||
@ -147,8 +149,7 @@ export async function initDatabase() {
|
||||
|
||||
if (!databaseInitialized(db)) {
|
||||
init(db);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
migrate(db);
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,9 @@ function initSchemaInV2(db: Database) {
|
||||
}
|
||||
|
||||
/*
|
||||
* This function assumes that the database does not contain the "config" table,
|
||||
* and thus needs to be migrated to Version 2.
|
||||
* */
|
||||
* This function assumes that the database does not contain the "config" table,
|
||||
* and thus needs to be migrated to Version 2.
|
||||
* */
|
||||
export function migrateToV2(db: Database) {
|
||||
initSchemaInV2(db);
|
||||
|
||||
@ -65,12 +65,11 @@ export function migrateToV2(db: Database) {
|
||||
// Before: /Users/username/Library/Application Support/OpenRewind/Record Data/temp/screenshots/1733568609960.jpg
|
||||
// After: 1733568609960.jpg
|
||||
const rows = db.prepare("SELECT id, imgFilename FROM frame").all() as OldFrame[];
|
||||
rows.forEach(row => {
|
||||
rows.forEach((row) => {
|
||||
const filename = row.imgFilename.match(/[^\\/]+$/)?.[0];
|
||||
|
||||
if (filename) {
|
||||
db.prepare("UPDATE frame SET imgFilename = ? WHERE id = ?")
|
||||
.run(filename, row.id);
|
||||
db.prepare("UPDATE frame SET imgFilename = ? WHERE id = ?").run(filename, row.id);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -24,7 +24,10 @@ function transformEncodingTask(db: Database) {
|
||||
`;
|
||||
db.exec(createTableSql);
|
||||
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM encoding_task`).all() as { [x: string]: unknown; id: unknown; }[];
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM encoding_task`).all() as {
|
||||
[x: string]: unknown;
|
||||
id: unknown;
|
||||
}[];
|
||||
const updateStmt = db.prepare(`UPDATE encoding_task SET createdAt_new = ? WHERE id = ?`);
|
||||
rows.forEach((row) => {
|
||||
const unixTimestamp = convertTimestampToUnix(row.createdAt as string);
|
||||
@ -55,10 +58,13 @@ function transformFrame(db: Database) {
|
||||
DROP TABLE frame;
|
||||
ALTER TABLE frame_new RENAME TO frame;
|
||||
ALTER TABLE frame ADD COLUMN createdAt_new REAL;
|
||||
`
|
||||
`;
|
||||
db.exec(createTableSql);
|
||||
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM frame`).all() as { [x: string]: unknown; id: unknown; }[];
|
||||
const rows = db.prepare(`SELECT id, createdAt FROM frame`).all() as {
|
||||
[x: string]: unknown;
|
||||
id: unknown;
|
||||
}[];
|
||||
const updateStmt = db.prepare(`UPDATE frame SET createdAt_new = ? WHERE id = ?`);
|
||||
rows.forEach((row) => {
|
||||
const unixTimestamp = convertTimestampToUnix(row.createdAt as string);
|
||||
@ -92,7 +98,10 @@ function transformSegments(db: Database) {
|
||||
ALTER TABLE segments ADD COLUMN startedAt_new REAL;
|
||||
ALTER TABLE segments ADD COLUMN endedAt_new REAL;
|
||||
`);
|
||||
const rows = db.prepare(`SELECT id, startedAt, endedAt FROM segments`).all() as { [x: string]: unknown; id: unknown; }[];
|
||||
const rows = db.prepare(`SELECT id, startedAt, endedAt FROM segments`).all() as {
|
||||
[x: string]: unknown;
|
||||
id: unknown;
|
||||
}[];
|
||||
const updateStart = db.prepare(`UPDATE segments SET startedAt_new = ? WHERE id = ?`);
|
||||
const updateEnd = db.prepare(`UPDATE segments SET endedAt_new = ? WHERE id = ?`);
|
||||
rows.forEach((row) => {
|
||||
@ -108,8 +117,17 @@ function transformSegments(db: Database) {
|
||||
`);
|
||||
}
|
||||
|
||||
function renameColumn(tableName: string, oldColumnName: string, newColumnName: string, db: Database) {
|
||||
if (db.prepare(`SELECT 1 FROM pragma_table_info(?) WHERE name=?`).get([tableName, oldColumnName])) {
|
||||
function renameColumn(
|
||||
tableName: string,
|
||||
oldColumnName: string,
|
||||
newColumnName: string,
|
||||
db: Database
|
||||
) {
|
||||
if (
|
||||
db
|
||||
.prepare(`SELECT 1 FROM pragma_table_info(?) WHERE name=?`)
|
||||
.get([tableName, oldColumnName])
|
||||
) {
|
||||
db.exec(`ALTER TABLE ${tableName} RENAME COLUMN ${oldColumnName} TO ${newColumnName};`);
|
||||
}
|
||||
}
|
||||
@ -173,10 +191,10 @@ export function migrateToV3(db: Database) {
|
||||
PRAGMA foreign_keys = ON;
|
||||
`);
|
||||
|
||||
renameColumn('encoding_task', 'createAt', 'createdAt', db);
|
||||
renameColumn('frame', 'createAt', 'createdAt', db);
|
||||
renameColumn('segments', 'startAt', 'startedAt', db);
|
||||
renameColumn('segments', 'endAt', 'endedAt', db);
|
||||
renameColumn("encoding_task", "createAt", "createdAt", db);
|
||||
renameColumn("frame", "createAt", "createdAt", db);
|
||||
renameColumn("segments", "startAt", "startedAt", db);
|
||||
renameColumn("segments", "endAt", "endedAt", db);
|
||||
if (db.prepare(`SELECT 1 FROM pragma_table_info('frame') WHERE name='encoded'`).get()) {
|
||||
db.prepare(`ALTER TABLE frame DROP COLUMN encoded`).run();
|
||||
}
|
||||
|
1
src/electron/backend/schema.d.ts
vendored
1
src/electron/backend/schema.d.ts
vendored
@ -9,7 +9,6 @@ export interface Frame {
|
||||
encodeStatus: number;
|
||||
}
|
||||
|
||||
|
||||
export interface EncodingTask {
|
||||
id: number;
|
||||
createdAt: number;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import screenshot from "screenshot-desktop";
|
||||
import { getScreenshotsDir } from "../utils/backend.js";
|
||||
import { join } from "path";
|
||||
import { Database }from "better-sqlite3";
|
||||
import { Database } from "better-sqlite3";
|
||||
import SqlString from "sqlstring";
|
||||
|
||||
export function startScreenshotLoop(db: Database) {
|
||||
@ -10,15 +10,16 @@ export function startScreenshotLoop(db: Database) {
|
||||
const screenshotDir = getScreenshotsDir();
|
||||
const filename = `${timestamp}.png`;
|
||||
const screenshotPath = join(screenshotDir, filename);
|
||||
screenshot({filename: screenshotPath, format: "png"}).then((absolutePath) => {
|
||||
screenshot({ filename: screenshotPath, format: "png" })
|
||||
.then((absolutePath) => {
|
||||
const SQL = SqlString.format(
|
||||
"INSERT INTO frame (imgFilename, createdAt) VALUES (?, ?)",
|
||||
[filename, new Date().getTime() / 1000]
|
||||
);
|
||||
db.exec(SQL);
|
||||
}).catch((err) => {
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,12 @@ function loadURL(window: BrowserWindow, path = "", vitePort: string) {
|
||||
window.loadURL(`http://localhost:${vitePort}/#${path}`).catch((e) => {
|
||||
console.log("Error loading URL:", e);
|
||||
});
|
||||
}
|
||||
else {
|
||||
window.loadFile(join(__dirname, "../renderer/index.html"), {
|
||||
hash: path,
|
||||
}).catch((e) => {
|
||||
} else {
|
||||
window
|
||||
.loadFile(join(__dirname, "../renderer/index.html"), {
|
||||
hash: path
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("Error loading URL:", e);
|
||||
});
|
||||
}
|
||||
@ -26,7 +27,7 @@ export function createSettingsWindow(vitePort: string, closeCallBack: Function)
|
||||
defaultHeight: 550
|
||||
});
|
||||
const enableFrame = process.platform === "darwin";
|
||||
let icon
|
||||
let icon;
|
||||
switch (process.platform) {
|
||||
case "darwin":
|
||||
icon = undefined;
|
||||
@ -46,13 +47,13 @@ export function createSettingsWindow(vitePort: string, closeCallBack: Function)
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: true,
|
||||
preload: join(__dirname, 'preload/settings.cjs')
|
||||
preload: join(__dirname, "preload/settings.cjs")
|
||||
},
|
||||
titleBarStyle: "hiddenInset",
|
||||
resizable: false,
|
||||
show: false,
|
||||
frame: enableFrame,
|
||||
icon: icon,
|
||||
icon: icon
|
||||
});
|
||||
windowState.manage(window);
|
||||
window.on("show", () => {
|
||||
@ -92,7 +93,7 @@ export function createMainWindow(vitePort: string, closeCallBack: Function) {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: true,
|
||||
preload: join(__dirname, 'preload/rewind.cjs')
|
||||
preload: join(__dirname, "preload/rewind.cjs")
|
||||
},
|
||||
roundedCorners: false,
|
||||
transparent: true,
|
||||
|
@ -4,7 +4,6 @@ import fs from "fs";
|
||||
import { app } from "electron";
|
||||
import { __dirname } from "./dirname.js";
|
||||
|
||||
|
||||
/**
|
||||
* Selects the appropriate language based on system preferences and available languages
|
||||
*
|
||||
@ -21,7 +20,7 @@ export function detectLanguage(langs: string[], fallback: string): string {
|
||||
const normalizedLang = systemLanguage.toLowerCase().split("-")[0];
|
||||
|
||||
// Find a matching language
|
||||
const matchedLanguage = langs.find(lang => {
|
||||
const matchedLanguage = langs.find((lang) => {
|
||||
if (lang.indexOf(normalizedLang) !== -1) {
|
||||
return lang;
|
||||
}
|
||||
@ -53,4 +52,3 @@ export default function initI18n() {
|
||||
});
|
||||
return i18n;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,13 @@
|
||||
import { app, BrowserWindow, globalShortcut, ipcMain, Menu, nativeImage, screen, Tray } from "electron";
|
||||
import {
|
||||
app,
|
||||
BrowserWindow,
|
||||
globalShortcut,
|
||||
ipcMain,
|
||||
Menu,
|
||||
nativeImage,
|
||||
screen,
|
||||
Tray
|
||||
} from "electron";
|
||||
import contextMenu from "electron-context-menu";
|
||||
import { join } from "path";
|
||||
import initI18n from "./i18n.js";
|
||||
@ -8,12 +17,16 @@ import { Database } from "better-sqlite3";
|
||||
import { startScreenshotLoop } from "./backend/screenshot.js";
|
||||
import { __dirname } from "./dirname.js";
|
||||
import { hideDock } from "./utils/electron.js";
|
||||
import { checkFramesForEncoding, deleteUnnecessaryScreenshots, processEncodingTasks } from "./backend/encoding.js";
|
||||
import {
|
||||
checkFramesForEncoding,
|
||||
deleteUnnecessaryScreenshots,
|
||||
processEncodingTasks
|
||||
} from "./backend/encoding.js";
|
||||
import honoApp from "./server/index.js";
|
||||
import { serve } from "@hono/node-server";
|
||||
import { findAvailablePort } from "./utils/server.js";
|
||||
import cache from "memory-cache";
|
||||
import { generate } from '@alikia/random-key';
|
||||
import { generate } from "@alikia/random-key";
|
||||
|
||||
const i18n = initI18n();
|
||||
|
||||
@ -75,21 +88,19 @@ contextMenu({
|
||||
app.once("ready", () => {
|
||||
hideDock();
|
||||
});
|
||||
app.on("activate", () => {
|
||||
});
|
||||
app.on("activate", () => {});
|
||||
|
||||
app.on("ready", () => {
|
||||
createTray();
|
||||
findAvailablePort(12412).then((port) => {
|
||||
generate().then((key) => {
|
||||
cache.put("server:APIKey",key);
|
||||
cache.put("server:APIKey", key);
|
||||
cache.put("server:port", port);
|
||||
if (dev)
|
||||
console.log(`API Key: ${key}`);
|
||||
if (dev) console.log(`API Key: ${key}`);
|
||||
serve({ fetch: honoApp.fetch, port: port });
|
||||
console.log(`App server running on port ${port}`);
|
||||
});
|
||||
})
|
||||
});
|
||||
initDatabase().then((db) => {
|
||||
screenshotInterval = startScreenshotLoop(db);
|
||||
setInterval(checkFramesForEncoding, 5000, db);
|
||||
@ -108,8 +119,7 @@ app.on("ready", () => {
|
||||
|
||||
app.on("will-quit", () => {
|
||||
dbConnection?.close();
|
||||
if (screenshotInterval)
|
||||
clearInterval(screenshotInterval);
|
||||
if (screenshotInterval) clearInterval(screenshotInterval);
|
||||
});
|
||||
|
||||
// app.on("window-all-closed", () => {
|
||||
|
@ -1,52 +1,52 @@
|
||||
const os = require('node:os');
|
||||
const os = require("node:os");
|
||||
|
||||
const nameMap = new Map([
|
||||
[24, ['Sequoia', '15']],
|
||||
[23, ['Sonoma', '14']],
|
||||
[22, ['Ventura', '13']],
|
||||
[21, ['Monterey', '12']],
|
||||
[20, ['Big Sur', '11']],
|
||||
[19, ['Catalina', '10.15']],
|
||||
[18, ['Mojave', '10.14']],
|
||||
[17, ['High Sierra', '10.13']],
|
||||
[16, ['Sierra', '10.12']],
|
||||
[15, ['El Capitan', '10.11']],
|
||||
[14, ['Yosemite', '10.10']],
|
||||
[13, ['Mavericks', '10.9']],
|
||||
[12, ['Mountain Lion', '10.8']],
|
||||
[11, ['Lion', '10.7']],
|
||||
[10, ['Snow Leopard', '10.6']],
|
||||
[9, ['Leopard', '10.5']],
|
||||
[8, ['Tiger', '10.4']],
|
||||
[7, ['Panther', '10.3']],
|
||||
[6, ['Jaguar', '10.2']],
|
||||
[5, ['Puma', '10.1']],
|
||||
[24, ["Sequoia", "15"]],
|
||||
[23, ["Sonoma", "14"]],
|
||||
[22, ["Ventura", "13"]],
|
||||
[21, ["Monterey", "12"]],
|
||||
[20, ["Big Sur", "11"]],
|
||||
[19, ["Catalina", "10.15"]],
|
||||
[18, ["Mojave", "10.14"]],
|
||||
[17, ["High Sierra", "10.13"]],
|
||||
[16, ["Sierra", "10.12"]],
|
||||
[15, ["El Capitan", "10.11"]],
|
||||
[14, ["Yosemite", "10.10"]],
|
||||
[13, ["Mavericks", "10.9"]],
|
||||
[12, ["Mountain Lion", "10.8"]],
|
||||
[11, ["Lion", "10.7"]],
|
||||
[10, ["Snow Leopard", "10.6"]],
|
||||
[9, ["Leopard", "10.5"]],
|
||||
[8, ["Tiger", "10.4"]],
|
||||
[7, ["Panther", "10.3"]],
|
||||
[6, ["Jaguar", "10.2"]],
|
||||
[5, ["Puma", "10.1"]]
|
||||
]);
|
||||
|
||||
const names = new Map([
|
||||
['10.0.2', '11'], // It's unclear whether future Windows 11 versions will use this version scheme: https://github.com/sindresorhus/windows-release/pull/26/files#r744945281
|
||||
['10.0', '10'],
|
||||
['6.3', '8.1'],
|
||||
['6.2', '8'],
|
||||
['6.1', '7'],
|
||||
['6.0', 'Vista'],
|
||||
['5.2', 'Server 2003'],
|
||||
['5.1', 'XP'],
|
||||
['5.0', '2000'],
|
||||
['4.90', 'ME'],
|
||||
['4.10', '98'],
|
||||
['4.03', '95'],
|
||||
['4.00', '95'],
|
||||
["10.0.2", "11"], // It's unclear whether future Windows 11 versions will use this version scheme: https://github.com/sindresorhus/windows-release/pull/26/files#r744945281
|
||||
["10.0", "10"],
|
||||
["6.3", "8.1"],
|
||||
["6.2", "8"],
|
||||
["6.1", "7"],
|
||||
["6.0", "Vista"],
|
||||
["5.2", "Server 2003"],
|
||||
["5.1", "XP"],
|
||||
["5.0", "2000"],
|
||||
["4.90", "ME"],
|
||||
["4.10", "98"],
|
||||
["4.03", "95"],
|
||||
["4.00", "95"]
|
||||
]);
|
||||
|
||||
function macosRelease(release) {
|
||||
release = Number((release || os.release()).split('.')[0]);
|
||||
release = Number((release || os.release()).split(".")[0]);
|
||||
|
||||
const [name, version] = nameMap.get(release) || ['Unknown', ''];
|
||||
const [name, version] = nameMap.get(release) || ["Unknown", ""];
|
||||
|
||||
return {
|
||||
name,
|
||||
version,
|
||||
version
|
||||
};
|
||||
}
|
||||
|
||||
@ -54,14 +54,14 @@ function windowsRelease(release) {
|
||||
const version = /(\d+\.\d+)(?:\.(\d+))?/.exec(release || os.release());
|
||||
|
||||
if (release && !version) {
|
||||
throw new Error('`release` argument doesn\'t match `n.n`');
|
||||
throw new Error("`release` argument doesn't match `n.n`");
|
||||
}
|
||||
|
||||
let ver = version[1] || '';
|
||||
const build = version[2] || '';
|
||||
let ver = version[1] || "";
|
||||
const build = version[2] || "";
|
||||
|
||||
if (ver === '10.0' && build.startsWith('2')) {
|
||||
ver = '10.0.2';
|
||||
if (ver === "10.0" && build.startsWith("2")) {
|
||||
ver = "10.0.2";
|
||||
}
|
||||
|
||||
return names.get(ver);
|
||||
@ -69,47 +69,47 @@ function windowsRelease(release) {
|
||||
|
||||
function osName(platform, release) {
|
||||
if (!platform && release) {
|
||||
throw new Error('You can\'t specify a `release` without specifying `platform`');
|
||||
throw new Error("You can't specify a `release` without specifying `platform`");
|
||||
}
|
||||
|
||||
platform = platform ?? os.platform();
|
||||
|
||||
let id;
|
||||
|
||||
if (platform === 'darwin') {
|
||||
if (!release && os.platform() === 'darwin') {
|
||||
if (platform === "darwin") {
|
||||
if (!release && os.platform() === "darwin") {
|
||||
release = os.release();
|
||||
}
|
||||
|
||||
const prefix = release ? (Number(release.split('.')[0]) > 15 ? 'macOS' : 'OS X') : 'macOS';
|
||||
const prefix = release ? (Number(release.split(".")[0]) > 15 ? "macOS" : "OS X") : "macOS";
|
||||
|
||||
try {
|
||||
id = release ? macosRelease(release).name : '';
|
||||
id = release ? macosRelease(release).name : "";
|
||||
|
||||
if (id === 'Unknown') {
|
||||
if (id === "Unknown") {
|
||||
return prefix;
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return prefix + (id ? ' ' + id : '');
|
||||
return prefix + (id ? " " + id : "");
|
||||
}
|
||||
|
||||
if (platform === 'linux') {
|
||||
if (!release && os.platform() === 'linux') {
|
||||
if (platform === "linux") {
|
||||
if (!release && os.platform() === "linux") {
|
||||
release = os.release();
|
||||
}
|
||||
|
||||
id = release ? release.replace(/^(\d+\.\d+).*/, '$1') : '';
|
||||
return 'Linux' + (id ? ' ' + id : '');
|
||||
id = release ? release.replace(/^(\d+\.\d+).*/, "$1") : "";
|
||||
return "Linux" + (id ? " " + id : "");
|
||||
}
|
||||
|
||||
if (platform === 'win32') {
|
||||
if (!release && os.platform() === 'win32') {
|
||||
if (platform === "win32") {
|
||||
if (!release && os.platform() === "win32") {
|
||||
release = os.release();
|
||||
}
|
||||
|
||||
id = release ? windowsRelease(release) : '';
|
||||
return 'Windows' + (id ? ' ' + id : '');
|
||||
id = release ? windowsRelease(release) : "";
|
||||
return "Windows" + (id ? " " + id : "");
|
||||
}
|
||||
|
||||
return platform;
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { app } from "electron";
|
||||
|
||||
export function hideDock(){
|
||||
if (process.platform === 'darwin') {
|
||||
export function hideDock() {
|
||||
if (process.platform === "darwin") {
|
||||
// Hide the dock icon on macOS
|
||||
app.dock.hide();
|
||||
}
|
||||
}
|
||||
|
||||
export function showDock(){
|
||||
if (process.platform === 'darwin') {
|
||||
export function showDock() {
|
||||
if (process.platform === "darwin") {
|
||||
// Show the dock icon on macOS
|
||||
app.dock.show();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { detect } from 'detect-port';
|
||||
import { detect } from "detect-port";
|
||||
|
||||
/**
|
||||
* Finds an available port starting from a given port.
|
||||
@ -7,10 +7,10 @@ import { detect } from 'detect-port';
|
||||
*/
|
||||
export async function findAvailablePort(startingFrom: number): Promise<number> {
|
||||
return detect(startingFrom)
|
||||
.then(realPort => {
|
||||
.then((realPort) => {
|
||||
return realPort; // Return the available port
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
console.error(`Error detecting port: ${err.message}`);
|
||||
throw err; // Rethrow the error for further handling if needed
|
||||
});
|
||||
|
12
src/global.d.ts
vendored
12
src/global.d.ts
vendored
@ -8,12 +8,12 @@ interface Window {
|
||||
};
|
||||
electron: {
|
||||
getScreenshot: () => Promise<string>;
|
||||
}
|
||||
};
|
||||
api: {
|
||||
send: (channel: any, data: any) => void,
|
||||
receive: (channel: any, func: any) => void
|
||||
},
|
||||
send: (channel: any, data: any) => void;
|
||||
receive: (channel: any, func: any) => void;
|
||||
};
|
||||
settingsWindow: {
|
||||
close: () => void,
|
||||
}
|
||||
close: () => void;
|
||||
};
|
||||
}
|
@ -2,7 +2,7 @@ import { HashRouter, Routes, Route } from "react-router-dom";
|
||||
import SettingsPage from "pages/settings";
|
||||
import "./i18n.ts";
|
||||
import RewindPage from "pages/rewind";
|
||||
import './app.css';
|
||||
import "./app.css";
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
|
@ -38,7 +38,7 @@ i18n.use(initReactI18next) // passes i18n down to react-i18next
|
||||
},
|
||||
ko: {
|
||||
translation: ko
|
||||
},
|
||||
}
|
||||
},
|
||||
fallbackLng: "en",
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
</body>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,7 +4,7 @@ const config: Config = {
|
||||
content: [
|
||||
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./src/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./src/**/*.{js,ts,jsx,tsx,mdx}"
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
|
@ -31,5 +31,5 @@
|
||||
"src/global.d.ts",
|
||||
"pages/**/*.tsx",
|
||||
"components/**/*.tsx"
|
||||
],
|
||||
]
|
||||
}
|
||||
|
@ -11,8 +11,5 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["src/electron"],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json"},
|
||||
{ "path": "./tsconfig.node.json"}
|
||||
]
|
||||
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
|
@ -19,7 +19,5 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": [
|
||||
"vite.config.ts"
|
||||
]
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ export default defineConfig({
|
||||
customChunk: (args) => {
|
||||
// files into pages directory is export in single files
|
||||
const { id } = args;
|
||||
if (id.includes('node_modules')) {
|
||||
return 'vendor';
|
||||
if (id.includes("node_modules")) {
|
||||
return "vendor";
|
||||
} else {
|
||||
return 'main';
|
||||
return "main";
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user