Merge to main

This commit is contained in:
Thomas Rogers 2024-11-30 00:12:11 +01:00
parent ad6a997a1f
commit da6ab7aa4a
5 changed files with 10 additions and 22 deletions

View file

@ -5,6 +5,7 @@ import { TaskState } from '../generated/graphql'
import { findExportById, saveExport } from '../services/export'
import { findHighlightsByLibraryItemId } from '../services/highlights'
import {
countLibraryItems,
findLibraryItemById,
searchLibraryItems,
} from '../services/library_item'
@ -12,17 +13,11 @@ import { sendExportJobEmail } from '../services/send_emails'
import { findActiveUser } from '../services/user'
import { logger } from '../utils/logger'
import { highlightToMarkdown } from '../utils/parser'
import { contentFilePath } from '../utils/uploads'
import { env } from '../env'
import { storage } from '../repository/storage/storage'
import { File } from '../repository/storage/StorageClient'
import { Readable } from 'stream'
import {
contentFilePath,
createGCSFile,
generateUploadFilePathName,
} from '../utils/uploads'
import { batch } from 'googleapis/build/src/apis/batch'
import { contentFilePath, generateUploadFilePathName } from '../utils/uploads'
import { getRepository } from '../repository'
import { UploadFile } from '../entity/upload_file'
@ -67,7 +62,7 @@ const uploadContent = async (
const file = createGCSFile(filePath)
// check if file is already uploaded
const [exists] = await file.exists()
const exists = await file.exists()
if (!exists) {
logger.info(`File not found: ${filePath}`)
@ -107,17 +102,19 @@ const uploadPdfContent = async (
id: libraryItem.uploadFileId,
})
if (!upload || !upload.fileName) {
console.log(`upload does not have a filename: ${upload}`)
console.log(
`upload does not have a filename: ${upload?.fileName ?? 'empty'}`
)
return
}
const filePath = generateUploadFilePathName(upload.id, upload.fileName)
const file = createGCSFile(filePath)
const [exists] = await file.exists()
const exists = await file.exists()
if (exists) {
console.log(`adding PDF file: ${filePath}`)
// append the existing file to the archive
archive.append(file.createReadStream(), {
archive.append(await file.download(), {
name: `content/${libraryItem.slug}.pdf`,
})
}
@ -279,7 +276,7 @@ export const exportJob = async (jobData: ExportJobData) => {
// Pipe the archiver output to the write stream
archive.pipe(writeStream)
let cursor = 0
try {
// fetch data from the database
const batchSize = 20
@ -326,7 +323,7 @@ export const exportJob = async (jobData: ExportJobData) => {
})
// generate a temporary signed url for the zip file
const [signedUrl] = await file.getSignedUrl({
const signedUrl = await storage.signedUrl(bucketName, fullPath, {
action: 'read',
expires: Date.now() + 168 * 60 * 60 * 1000, // one week
})

View file

@ -1,5 +1,4 @@
import { Box, VStack, HStack } from '../elements/LayoutPrimitives'
import { ShutdownBanner } from '../elements/ShutdownBanner'
import { OmnivoreNameLogo } from '../elements/images/OmnivoreNameLogo'
import { theme } from '../tokens/stitches.config'
import { GoogleReCaptchaProvider } from '@google-recaptcha/react'

View file

@ -10,12 +10,10 @@ import type { LoginFormProps } from './LoginForm'
import { OmnivoreNameLogo } from '../elements/images/OmnivoreNameLogo'
import featureFullWidthImage from '../../public/static/images/login/login-feature-image-full.png'
import { ShutdownBanner } from '../elements/ShutdownBanner'
export function LoginLayout(props: LoginFormProps): JSX.Element {
return (
<>
<ShutdownBanner />
<MediumBreakpointBox
smallerLayoutNode={<MobileLoginLayout {...props} />}
largerLayoutNode={<MediumLoginLayout {...props} />}

View file

@ -21,9 +21,6 @@ import useWindowDimensions from '../../lib/hooks/useGetWindowDimensions'
import { useHandleAddUrl } from '../../lib/hooks/useHandleAddUrl'
import { useGetViewer } from '../../lib/networking/viewer/useGetViewer'
import { useQueryClient } from '@tanstack/react-query'
import { usePersistedState } from '../../lib/hooks/usePersistedState'
import { CloseButton } from '../elements/CloseButton'
import { ShutdownBanner } from '../elements/ShutdownBanner'
export type NavigationSection =
| 'home'
@ -207,7 +204,6 @@ const Header = (props: HeaderProps): JSX.Element => {
height: '58px',
}}
>
<ShutdownBanner />
<Button
style="plainIcon"
onClick={(event) => {

View file

@ -13,7 +13,6 @@ import { useVerifyAuth } from '../../lib/hooks/useVerifyAuth'
import Link from 'next/link'
import { CaretLeft } from '@phosphor-icons/react'
import { DEFAULT_HOME_PATH } from '../../lib/navigations'
import { ShutdownBanner } from '../elements/ShutdownBanner'
type SettingsLayoutProps = {
title?: string
@ -83,7 +82,6 @@ export function SettingsLayout(props: SettingsLayoutProps): JSX.Element {
css={{ width: '100%', height: '100%', minHeight: '100vh' }}
>
<PageMetaData path="settings" title="Settings" />
<ShutdownBanner />
<VStack css={{ width: '100%', height: '100%' }}>
<Box
css={{