Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[二开]这个可以内置源吗 #403

Open
liu5978 opened this issue Feb 15, 2025 · 8 comments
Open

[二开]这个可以内置源吗 #403

liu5978 opened this issue Feb 15, 2025 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@liu5978
Copy link

liu5978 commented Feb 15, 2025

No description provided.

@Hiram-Wong
Copy link
Owner

  • 我不算集成,因为你们不承担相应的风险,全部由作者承担
  • 二开可以自己集成

@liu5978
Copy link
Author

liu5978 commented Feb 15, 2025

改哪个文件?

@Hiram-Wong
Copy link
Owner

改初始化数据库 src/main/core/db/migration/modules/update0_0_0to3_3_1.ts

@liu5978
Copy link
Author

liu5978 commented Feb 15, 2025

import { db, client, schema } from '../../common';
import { tblSetting } from './init';
import logger from '@main/core/logger';

const update = async () => {
try {
await client.exec(`
CREATE TABLE IF NOT EXISTS tbl_setting (
id uuid DEFAULT gen_random_uuid(),
key varchar(255) not null,
value text DEFAULT null
);

        CREATE TABLE IF NOT EXISTS tbl_site (
            id uuid DEFAULT gen_random_uuid(),
            name varchar(255) not null,
            key varchar(255) not null,
            api varchar(255) not null,
            "playUrl" varchar(255),
            search integer not null default 0,
            "group" varchar(255),
            type integer not null,
            ext text,
            categories varchar(255),
            "isActive" boolean not null default true
        );

        CREATE TABLE IF NOT EXISTS tbl_iptv (
            id uuid DEFAULT gen_random_uuid(),
            name varchar(255) not null,
            url text not null,
            type varchar(255) not null,
            epg varchar(255),
            logo varchar(255),
            "isActive" boolean not null default true
        );

        CREATE TABLE IF NOT EXISTS tbl_channel (
            id uuid DEFAULT gen_random_uuid(),
            name varchar(255) not null,
            url varchar(1024) not null,
            "group" varchar(255)
        );

        CREATE TABLE IF NOT EXISTS tbl_drive (
            id uuid DEFAULT gen_random_uuid(),
            name varchar(255) not null,
            server varchar(255) not null,
            "startPage" varchar(255),
            search boolean not null default false,
            headers varchar(255),
            params varchar(255),
            "showAll" boolean default false,
            "isActive" boolean not null default true
        );

        CREATE TABLE IF NOT EXISTS tbl_analyze (
            id uuid DEFAULT gen_random_uuid(),
            name varchar(255) not null,
            url varchar(255) not null,
            type integer not null default 0,
            "isActive" boolean not null default true
        );

        CREATE TABLE IF NOT EXISTS tbl_star (
            id uuid DEFAULT gen_random_uuid(),
            "date" integer,
            "relateId" varchar(255) not null,
            "videoId" varchar(510) not null,
            "videoImage" varchar(510),
            "videoName" varchar(510),
            "videoType" varchar(255),
            "videoRemarks" varchar(255)
        );

        CREATE TABLE IF NOT EXISTS tbl_history (
            id uuid DEFAULT gen_random_uuid(),
            "date" integer,
            "type" varchar(255) not null,
            "relateId" varchar(255),
            "siteSource" varchar(255),
            "playEnd" boolean,
            "videoId" varchar(510),
            "videoImage" varchar(510),
            "videoName" varchar(510),
            "videoIndex" varchar(510),
            "watchTime" real,
            "duration" real,
            "skipTimeInEnd" real,
            "skipTimeInStart" real
        );
    `);

    // 插入内置源到 tbl_site 表
    const builtInSource = {
        name: '内置源名称',
        key: 'built_in_source_key',
        api: 'https://example.com/api',
        playUrl: 'https://example.com/play',
        search: 1,
        group: '内置源组',
        type: 1,
        ext: '一些额外信息',
        categories: '电影,电视剧',
        isActive: true
    };

    await db.insert(schema.site).values(builtInSource);

    if ((await db.select().from(schema.setting)).length === 0) {
        for (const item of tblSetting) {
            await db.insert(schema.setting).values({ key: item.key, value: { data: item.value } });
        }
    }

    logger.info('[db][init]completed');
} catch (error) {
    logger.error('[db][init]error', error);
}

};

export default update;

@liu5978
Copy link
Author

liu5978 commented Feb 15, 2025

这样改可以吗?

@Hiram-Wong
Copy link
Owner

试试就知道了

@Hiram-Wong
Copy link
Owner

如二开请遵守开源协议

@Hiram-Wong Hiram-Wong changed the title 这个可以内置源吗 [二开]这个可以内置源吗 Feb 15, 2025
@Hiram-Wong Hiram-Wong added the help wanted Extra attention is needed label Feb 15, 2025
@liu5978
Copy link
Author

liu5978 commented Feb 15, 2025

好的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants