rename to comic from manga

This commit is contained in:
monoid 2021-02-22 16:41:08 +09:00
parent 531152d821
commit dafce3ebf6
16 changed files with 46 additions and 43 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# Ionian
내가 쓸려고 만든 거.

View File

@ -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~~

View File

@ -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 ? (<Box className={propclasses.tag_list || classes.tag_list}>{document.tags.map(x =>
(<TagChip key={x} label={x} clickable tagname={x} size="small"></TagChip>)
)}</Box>) : (
<MangaDetailTag tags={document.tags} classes={({tag_list:classes.tag_list})}></MangaDetailTag>)
<ComicDetailTag tags={document.tags} classes={({tag_list:classes.tag_list})}></ComicDetailTag>)
}
</Box>
</Box>
</Paper>);
}
function MangaDetailTag(prop:{tags:string[],classes:{
function ComicDetailTag(prop:{tags:string[],classes:{
tag_list:string
}}){
let allTag = prop.tags;

View File

@ -32,7 +32,7 @@ export function CommonMenuList(props?:{url?:string}) {
return (<NavList>
{url !== "" && <><BackItem /> <Divider /></>}
<NavItem name="All" to="/" icon={<HomeIcon />} />
<NavItem name="Manga" to="/search?content_type=manga" icon={<CollectionIcon />}></NavItem>
<NavItem name="Comic" to="/search?content_type=comic" icon={<CollectionIcon />}></NavItem>
<NavItem name="Video" to="/search?content_type=video" icon={<VideoIcon />} />
<Divider />
<NavItem name="Difference" to="/difference" icon={<FolderIcon/>}></NavItem>

View File

@ -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,

View File

@ -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 (<div style={{overflow: 'hidden', alignSelf:'center'}}>
<img onClick={PageUP} src={`/api/doc/${props.doc.id}/manga/${curPage}`}
<img onClick={PageUP} src={`/api/doc/${props.doc.id}/comic/${curPage}`}
style={{maxWidth:'100%', maxHeight:'calc(100vh - 64px)'}}></img>
</div>);
}
export default MangaReader;
export default ComicReader;

View File

@ -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;
}

View File

@ -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);
registerContentReferrer(ComicReferrer);

View File

@ -1,3 +1,3 @@
import './manga';
import './comic';
import './video';
export {ContentFile, createContentFile} from './file';

View File

@ -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}}}
{"$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}}}

View File

@ -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<ComicConfig>("comic_config.json",{watch:[]},ComicSchema);

View File

@ -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<MangaConfig>("manga_config.json",{watch:[]},MangaSchema);

View File

@ -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)));
}

View File

@ -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<ContentContext,DefaultContext>,next:Next)=>{

View File

@ -84,7 +84,7 @@ async function renderZipImage(ctx: Context, path: string, page: number) {
}
}
export class MangaRouter extends Router<ContentContext> {
export class ComicRouter extends Router<ContentContext> {
constructor() {
super();
this.get("/", async (ctx, next) => {
@ -100,4 +100,4 @@ export class MangaRouter extends Router<ContentContext> {
}
}
export default MangaRouter;
export default ComicRouter;

View File

@ -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());