changes
This commit is contained in:
@@ -25,7 +25,8 @@ export interface Business {
|
||||
}
|
||||
|
||||
export interface BusinessFile {
|
||||
name: string;
|
||||
/** Relative to the business directory, posix separators. */
|
||||
path: string;
|
||||
size: number;
|
||||
mtime: string;
|
||||
}
|
||||
@@ -73,3 +74,13 @@ export const api = {
|
||||
businessFiles: (id: string) => request<BusinessFile[]>(`/api/businesses/${id}/files`),
|
||||
scan: () => post<ScanResult>('/api/businesses/scan'),
|
||||
};
|
||||
|
||||
/** Same-origin streaming URL of one file inside a business directory. */
|
||||
export function businessFileUrl(id: string, filePath: string): string {
|
||||
return `/api/businesses/${id}/file?path=${encodeURIComponent(filePath)}`;
|
||||
}
|
||||
|
||||
/** The standalone (unbundled) pdf.js viewer page, pointed at a business file. */
|
||||
export function viewerUrl(id: string, filePath: string): string {
|
||||
return `/viewer/index.html?file=${encodeURIComponent(businessFileUrl(id, filePath))}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user