From dafce3ebf67990822e71987eb9d688a9fedde03d Mon Sep 17 00:00:00 2001 From: monoid Date: Mon, 22 Feb 2021 16:41:08 +0900 Subject: [PATCH] rename to comic from manga --- README.md | 3 +++ plan.md | 4 ++-- src/client/component/contentinfo.tsx | 6 +++--- src/client/component/navlist.tsx | 2 +- src/client/page/contentinfo.tsx | 2 +- src/client/page/reader/{manga.tsx => comic.tsx} | 10 +++++----- src/client/page/reader/reader.tsx | 6 +++--- src/content/{manga.ts => comic.ts} | 12 ++++++------ src/content/mod.ts | 2 +- ...ngaConfig.schema.json => ComicConfig.schema.json} | 2 +- src/diff/watcher/ComicConfig.ts | 8 ++++++++ src/diff/watcher/MangaConfig.ts | 8 -------- .../watcher/{manga_watcher.ts => comic_watcher.ts} | 12 ++++++------ src/route/all.ts | 4 ++-- src/route/{manga.ts => comic.ts} | 4 ++-- src/server.ts | 4 ++-- 16 files changed, 46 insertions(+), 43 deletions(-) create mode 100644 README.md rename src/client/page/reader/{manga.tsx => comic.tsx} (88%) rename src/content/{manga.ts => comic.ts} (89%) rename src/diff/watcher/{MangaConfig.schema.json => ComicConfig.schema.json} (68%) create mode 100644 src/diff/watcher/ComicConfig.ts delete mode 100644 src/diff/watcher/MangaConfig.ts rename src/diff/watcher/{manga_watcher.ts => comic_watcher.ts} (54%) rename src/route/{manga.ts => comic.ts} (97%) diff --git a/README.md b/README.md new file mode 100644 index 0000000..40c0fde --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Ionian + +내가 쓸려고 만든 거. \ No newline at end of file diff --git a/plan.md b/plan.md index 05e7ccb..ef4f063 100644 --- a/plan.md +++ b/plan.md @@ -5,7 +5,7 @@ ### server routing - content - \d+ - - manga + - comic - (?P<page>\d+) - video - diff @@ -34,7 +34,7 @@ - server push - ~~permission~~ - diff - - ~~manga~~ + - ~~comic~~ - video - html - ~~hash~~ diff --git a/src/client/component/contentinfo.tsx b/src/client/component/contentinfo.tsx index 12a45c9..4c42665 100644 --- a/src/client/component/contentinfo.tsx +++ b/src/client/component/contentinfo.tsx @@ -5,7 +5,7 @@ import { LoadingCircle } from '../component/loading'; import { Link, Paper, makeStyles, Theme, Box, useTheme, Typography } from '@material-ui/core'; import { ThumbnailContainer } from '../page/reader/reader'; import { TagChip } from '../component/tagchip'; -import { MangaReader } from '../page/reader/manga'; +import { ComicReader } from '../page/reader/comic'; export const makeContentInfoUrl = (id: number) => `/doc/${id}`; export const makeContentReaderUrl = (id: number) => `/doc/${id}/reader`; @@ -117,14 +117,14 @@ export const ContentInfo = (props: { {props.short ? ({document.tags.map(x => () )}) : ( - ) + ) } ); } -function MangaDetailTag(prop:{tags:string[],classes:{ +function ComicDetailTag(prop:{tags:string[],classes:{ tag_list:string }}){ let allTag = prop.tags; diff --git a/src/client/component/navlist.tsx b/src/client/component/navlist.tsx index 6879d77..8ca037a 100644 --- a/src/client/component/navlist.tsx +++ b/src/client/component/navlist.tsx @@ -32,7 +32,7 @@ export function CommonMenuList(props?:{url?:string}) { return ( {url !== "" && <> } } /> - }> + }> } /> }> diff --git a/src/client/page/contentinfo.tsx b/src/client/page/contentinfo.tsx index 2c201c1..84dd8c1 100644 --- a/src/client/page/contentinfo.tsx +++ b/src/client/page/contentinfo.tsx @@ -9,7 +9,7 @@ import { BackItem, CommonMenuList, ContentInfo, Headline, NavItem, NavList } fro import {NotFoundPage} from './404'; export const makeContentInfoUrl = (id: number) => `/doc/${id}`; -export const makeMangaReaderUrl = (id: number) => `/doc/${id}/reader`; +export const makeComicReaderUrl = (id: number) => `/doc/${id}/reader`; type DocumentState = { doc: Document | undefined, diff --git a/src/client/page/reader/manga.tsx b/src/client/page/reader/comic.tsx similarity index 88% rename from src/client/page/reader/manga.tsx rename to src/client/page/reader/comic.tsx index 631fd83..953e227 100644 --- a/src/client/page/reader/manga.tsx +++ b/src/client/page/reader/comic.tsx @@ -2,18 +2,18 @@ import React, {useState, useEffect} from 'react'; import { Typography, useTheme } from '@material-ui/core'; import { Document } from '../../accessor/document'; -type MangaType = "manga"|"artist cg"|"donjinshi"|"western" +type ComicType = "comic"|"artist cg"|"donjinshi"|"western" export type PresentableTag = { artist:string[], group: string[], series: string[], - type: MangaType, + type: ComicType, character: string[], tags: string[], } -export const MangaReader = (props:{doc:Document})=>{ +export const ComicReader = (props:{doc:Document})=>{ const theme = useTheme(); const additional = props.doc.additional; const [curPage,setCurPage] = useState(0); @@ -40,9 +40,9 @@ export const MangaReader = (props:{doc:Document})=>{ }); //theme.mixins.toolbar.minHeight; return (
-
); } -export default MangaReader; \ No newline at end of file +export default ComicReader; \ No newline at end of file diff --git a/src/client/page/reader/reader.tsx b/src/client/page/reader/reader.tsx index 71601b1..800247c 100644 --- a/src/client/page/reader/reader.tsx +++ b/src/client/page/reader/reader.tsx @@ -1,7 +1,7 @@ import { Typography } from '@material-ui/core'; import React from 'react'; import { Document, makeThumbnailUrl } from '../../accessor/document'; -import {MangaReader} from './manga'; +import {ComicReader} from './comic'; import {VideoReader} from './video' export interface PagePresenterProp{ @@ -14,8 +14,8 @@ interface PagePresenter{ export const getPresenter = (content:Document):PagePresenter => { switch (content.content_type) { - case "manga": - return MangaReader; + case "comic": + return ComicReader; case "video": return VideoReader; } diff --git a/src/content/manga.ts b/src/content/comic.ts similarity index 89% rename from src/content/manga.ts rename to src/content/comic.ts index d9bbc2f..e245954 100644 --- a/src/content/manga.ts +++ b/src/content/comic.ts @@ -3,19 +3,19 @@ import {readZip, readAllFromZip} from '../util/zipwrap'; import { DocumentBody } from '../model/doc'; import {extname} from 'path'; -type MangaType = "doujinshi"|"artist cg"|"manga"|"western"; -interface MangaDesc{ +type ComicType = "doujinshi"|"artist cg"|"manga"|"western"; +interface ComicDesc{ title:string, artist?:string[], group?:string[], series?:string[], - type:MangaType|[MangaType], + type:ComicType|[ComicType], character?:string[], tags?:string[] } const ImageExt = ['.gif', '.png', '.jpeg', '.bmp', '.webp', '.jpg']; -export class MangaReferrer extends createDefaultClass("manga"){ - desc: MangaDesc|undefined; +export class ComicReferrer extends createDefaultClass("comic"){ + desc: ComicDesc|undefined; pagenum: number; additional: ContentConstructOption| undefined; constructor(path:string,option?:ContentConstructOption){ @@ -62,4 +62,4 @@ export class MangaReferrer extends createDefaultClass("manga"){ }; } }; -registerContentReferrer(MangaReferrer); \ No newline at end of file +registerContentReferrer(ComicReferrer); \ No newline at end of file diff --git a/src/content/mod.ts b/src/content/mod.ts index df6fe69..0956d33 100644 --- a/src/content/mod.ts +++ b/src/content/mod.ts @@ -1,3 +1,3 @@ -import './manga'; +import './comic'; import './video'; export {ContentFile, createContentFile} from './file'; \ No newline at end of file diff --git a/src/diff/watcher/MangaConfig.schema.json b/src/diff/watcher/ComicConfig.schema.json similarity index 68% rename from src/diff/watcher/MangaConfig.schema.json rename to src/diff/watcher/ComicConfig.schema.json index 0e9bb2f..c2b29af 100644 --- a/src/diff/watcher/MangaConfig.schema.json +++ b/src/diff/watcher/ComicConfig.schema.json @@ -1 +1 @@ -{"$schema":"http://json-schema.org/draft-07/schema#","$ref":"#/definitions/MangaConfig","definitions":{"MangaConfig":{"type":"object","properties":{"watch":{"type":"array","items":{"type":"string"}},"$schema":{"type":"string"}},"required":["watch"],"additionalProperties":false}}} \ No newline at end of file +{"$schema":"http://json-schema.org/draft-07/schema#","$ref":"#/definitions/ComicConfig","definitions":{"ComicConfig":{"type":"object","properties":{"watch":{"type":"array","items":{"type":"string"}},"$schema":{"type":"string"}},"required":["watch"],"additionalProperties":false}}} \ No newline at end of file diff --git a/src/diff/watcher/ComicConfig.ts b/src/diff/watcher/ComicConfig.ts new file mode 100644 index 0000000..ea34493 --- /dev/null +++ b/src/diff/watcher/ComicConfig.ts @@ -0,0 +1,8 @@ +import {ConfigManager} from '../../util/configRW'; +import ComicSchema from "./ComicConfig.schema.json" +export interface ComicConfig{ + watch:string[] +} + +export const ComicConfig = new ConfigManager("comic_config.json",{watch:[]},ComicSchema); + diff --git a/src/diff/watcher/MangaConfig.ts b/src/diff/watcher/MangaConfig.ts deleted file mode 100644 index dad7876..0000000 --- a/src/diff/watcher/MangaConfig.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {ConfigManager} from '../../util/configRW'; -import MangaSchema from "./MangaConfig.schema.json" -export interface MangaConfig{ - watch:string[] -} - -export const MangaConfig = new ConfigManager("manga_config.json",{watch:[]},MangaSchema); - diff --git a/src/diff/watcher/manga_watcher.ts b/src/diff/watcher/comic_watcher.ts similarity index 54% rename from src/diff/watcher/manga_watcher.ts rename to src/diff/watcher/comic_watcher.ts index 0e48ebc..e8fbee8 100644 --- a/src/diff/watcher/manga_watcher.ts +++ b/src/diff/watcher/comic_watcher.ts @@ -3,15 +3,15 @@ import {EventEmitter} from 'events'; import { DocumentAccessor } from '../../model/doc'; import { WatcherFilter } from './watcher_filter'; import { RecursiveWatcher } from './recursive_watcher'; -import { MangaConfig } from './MangaConfig'; +import { ComicConfig } from './ComicConfig'; import {WatcherCompositer} from './compositer' -const createMangaWatcherBase = (path:string)=> { +const createComicWatcherBase = (path:string)=> { return new WatcherFilter(new RecursiveWatcher(path),(x)=>x.endsWith(".zip")); } -export const createMangaWatcher = ()=>{ - const file = MangaConfig.get_config_file(); - console.log(`register manga ${file.watch.join(",")}`) - return new WatcherCompositer(file.watch.map(path=>createMangaWatcherBase(path))); +export const createComicWatcher = ()=>{ + const file = ComicConfig.get_config_file(); + console.log(`register comic ${file.watch.join(",")}`) + return new WatcherCompositer(file.watch.map(path=>createComicWatcherBase(path))); } \ No newline at end of file diff --git a/src/route/all.ts b/src/route/all.ts index 9591cec..d99c3f7 100644 --- a/src/route/all.ts +++ b/src/route/all.ts @@ -2,11 +2,11 @@ import { DefaultContext, Middleware, Next, ParameterizedContext } from 'koa'; import compose from 'koa-compose'; import Router, { IParamMiddleware } from 'koa-router'; import { ContentContext } from './context'; -import MangaRouter from './manga'; +import ComicRouter from './comic'; import VideoRouter from './video'; const table:{[s:string]:Router|undefined} = { - "manga": new MangaRouter, + "comic": new ComicRouter, "video": new VideoRouter } const all_middleware = (cont: string|undefined, restarg: string|undefined)=>async (ctx:ParameterizedContext,next:Next)=>{ diff --git a/src/route/manga.ts b/src/route/comic.ts similarity index 97% rename from src/route/manga.ts rename to src/route/comic.ts index 04117e4..bb03f1e 100644 --- a/src/route/manga.ts +++ b/src/route/comic.ts @@ -84,7 +84,7 @@ async function renderZipImage(ctx: Context, path: string, page: number) { } } -export class MangaRouter extends Router { +export class ComicRouter extends Router { constructor() { super(); this.get("/", async (ctx, next) => { @@ -100,4 +100,4 @@ export class MangaRouter extends Router { } } -export default MangaRouter; +export default ComicRouter; diff --git a/src/server.ts b/src/server.ts index a9d95fb..bcd806f 100644 --- a/src/server.ts +++ b/src/server.ts @@ -14,7 +14,7 @@ import {createUserMiddleWare, createLoginRouter, isAdminFirst, getAdmin} from '. import {createInterface as createReadlineInterface} from 'readline'; import { DocumentAccessor, UserAccessor } from './model/mod'; -import { createMangaWatcher } from './diff/watcher/manga_watcher'; +import { createComicWatcher } from './diff/watcher/comic_watcher'; class ServerApplication{ readonly userController: UserAccessor; @@ -50,7 +50,7 @@ class ServerApplication{ app.use(createUserMiddleWare(this.userController)); let diff_router = createDiffRouter(this.diffManger); - this.diffManger.register("manga",createMangaWatcher()); + this.diffManger.register("comic",createComicWatcher()); let router = new Router(); router.use('/api/diff',diff_router.routes());