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

[PARKED] publish publication on an opds2 publication server #1113

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/common/api/api.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ILcpModuleApi } from "./interface/lcpApi.interface";
import { IOpdsModuleApi } from "./interface/opdsApi.interface";
import { IPublicationModuleApi } from "./interface/publicationApi.interface";
import { IReaderModuleApi } from "./interface/readerApi.interface";
import { IServerModuleApi } from "./interface/server.interface";
import { ISessionModuleApi } from "./interface/session.interface";

export type TApiMethod =
Expand All @@ -20,6 +21,7 @@ export type TApiMethod =
IKeyboardModuleApi &
IPublicationModuleApi &
IReaderModuleApi &
ISessionModuleApi;
ISessionModuleApi &
IServerModuleApi;

export type TApiMethodName = keyof TApiMethod;
20 changes: 20 additions & 0 deletions src/common/api/interface/server.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ==LICENSE-BEGIN==
// Copyright 2017 European Digital Reading Lab. All rights reserved.
// Licensed to the Readium Foundation under one or more contributor license agreements.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file exposed on Github (readium) in the project repository.
// ==LICENSE-END==

import { PublicationView } from "readium-desktop/common/views/publication";

export interface IServerApi {
setUrl: (url: string, token: string) => Promise<void>;
getUrl: () => Promise<[string, string]>;
publishPublication: (pub: PublicationView) => Promise<void>;
}

export interface IServerModuleApi {
"server/getUrl": IServerApi["getUrl"];
"server/setUrl": IServerApi["setUrl"];
"server/publishPublication": IServerApi["publishPublication"];
}
4 changes: 3 additions & 1 deletion src/common/api/methodApi.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ILcpApi } from "./interface/lcpApi.interface";
import { IOpdsApi } from "./interface/opdsApi.interface";
import { IPublicationApi } from "./interface/publicationApi.interface";
import { IReaderApi } from "./interface/readerApi.interface";
import { IServerApi } from "./interface/server.interface";
import { ISessionApi } from "./interface/session.interface";

export type TMethodApi =
Expand All @@ -20,4 +21,5 @@ export type TMethodApi =
keyof IKeyboardApi |
keyof ILcpApi |
keyof IReaderApi |
keyof ISessionApi;
keyof ISessionApi |
keyof IServerApi;
4 changes: 3 additions & 1 deletion src/common/api/moduleApi.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ type TKeyboardApi = "keyboardShortcuts";
type TLcpApi = "lcp";
type TReaderApi = "reader";
type TSessionApi = "session";
type TServerApi = "server";
export type TModuleApi =
TCatalogApi |
TPublicationApi |
TOpdsApi |
TKeyboardApi |
TLcpApi |
TReaderApi |
TSessionApi;
TSessionApi |
TServerApi;
11 changes: 11 additions & 0 deletions src/common/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// that can be found in the LICENSE file exposed on Github (readium) in the project repository.
// ==LICENSE-END=

import { ContentType } from "readium-desktop/utils/content-type";
import { ObjectKeys, ObjectValues } from "readium-desktop/utils/object-keys-values";

export const acceptedExtensionObject = {
Expand All @@ -18,6 +19,16 @@ export const acceptedExtensionObject = {
w3cAudiobook: ".lpf",
};

export const extensionToTypeLink = {
[acceptedExtensionObject.lcpLicence]: ContentType.Lcp,
[acceptedExtensionObject.epub]: ContentType.Epub,
[acceptedExtensionObject.epub3]: ContentType.Epub,
[acceptedExtensionObject.audiobook]: ContentType.AudioBookPacked,
[acceptedExtensionObject.audiobookLcp]: ContentType.AudioBookPackedLcp,
[acceptedExtensionObject.audiobookLcpAlt]: ContentType.AudioBookPackedLcp,
[acceptedExtensionObject.w3cAudiobook]: ContentType.Lpf,
};

export const acceptedExtensionArray = ObjectValues(acceptedExtensionObject);

export const acceptedExtension = (ext: string) =>
Expand Down
Loading