mirror of
https://github.com/colanode/colanode.git
synced 2025-12-22 06:29:25 +01:00
Web version (#43)
* Create client package * Create the UI package * Init web app * Use isomorphic 'ws' for web sockets * File and asset implementations * Use Opfs SAH version of sqlite in browser * Generate Svg sprites for emojis and icons * Include emojis sprite * Improve and refactor assets * More assets improvements * Implement emoji and icons db import as readonly * Improve import paths * Handle concurrency limits for sqlite * Fix event broadcast in web * Pass windowId for subscribe and unsubscribe queries in desktop * Remove asset context * Implement avatar upload/download with the new structure * Improve file handlings * Move the necessary dependencies to client and ui packages * Update packages * Improve open file dialog * Make sure database files are deleted in browser * Improve avatar loading * Improve file loading * Fix some assets * Implement asset caching for offline access * Small fixes and improvements * Use server instead of pre signed urls for file upload/download * Cleanup some client related metadata * Switch Axios with ky * Refactor mutation results * Minor concurrency fix * Refactor web sockets * Improve file uploading * Handle connection close on server * Use stream for downloading the file * Add config options for cors * Update document in all tabs on local change * Include necessary icons for web * Update docker compose * Implement server upgrade required component * Use correct client type and platform in web and desktop * Improve service worker * Improve versioning * Fix an import * Minor fixes * Update some user endpoints * Minor endpoint changes * Enable app badge for desktop * Add error handling in some database operations * Update mutation naming convention * Update query naming convention * Update event and some metadata naming conventions * Update event and job naming conventions in server * Update Github workflow files * Restructure assets directory * Update packages * Upgrade to Zod v4 * Upgrade to react 19 * Upgrade to tailwind v4 * Minor ui improvements * Fix some cursor pointers * Add browser not supported message in web * Enhance server create flow, allow insecure connections and custom api paths * Execute electron-rebuild as postinstall command * Update docker compose
This commit is contained in:
@@ -4,11 +4,11 @@ import {
|
||||
GetObjectCommand,
|
||||
HeadObjectCommand,
|
||||
} from '@aws-sdk/client-s3';
|
||||
import { FileAttributes } from '@colanode/core';
|
||||
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
||||
|
||||
import { config } from '@/lib/config';
|
||||
import { fileS3 } from '@/data/storage';
|
||||
import { FileAttributes } from '@colanode/core';
|
||||
import { s3Client } from '@colanode/server/data/storage';
|
||||
import { config } from '@colanode/server/lib/config';
|
||||
|
||||
export const buildFilePath = (
|
||||
workspaceId: string,
|
||||
@@ -24,14 +24,14 @@ export const buildUploadUrl = async (
|
||||
mimeType: string
|
||||
) => {
|
||||
const command = new PutObjectCommand({
|
||||
Bucket: config.fileS3.bucketName,
|
||||
Bucket: config.storage.bucketName,
|
||||
Key: path,
|
||||
ContentLength: size,
|
||||
ContentType: mimeType,
|
||||
});
|
||||
|
||||
const expiresIn = 60 * 60 * 4; // 4 hours
|
||||
const presignedUrl = await getSignedUrl(fileS3, command, {
|
||||
const presignedUrl = await getSignedUrl(s3Client, command, {
|
||||
expiresIn,
|
||||
});
|
||||
|
||||
@@ -40,11 +40,11 @@ export const buildUploadUrl = async (
|
||||
|
||||
export const buildDownloadUrl = async (path: string) => {
|
||||
const command = new GetObjectCommand({
|
||||
Bucket: config.fileS3.bucketName,
|
||||
Bucket: config.storage.bucketName,
|
||||
Key: path,
|
||||
});
|
||||
|
||||
const presignedUrl = await getSignedUrl(fileS3, command, {
|
||||
const presignedUrl = await getSignedUrl(s3Client, command, {
|
||||
expiresIn: 60 * 60 * 4, // 4 hours
|
||||
});
|
||||
|
||||
@@ -53,12 +53,12 @@ export const buildDownloadUrl = async (path: string) => {
|
||||
|
||||
export const fetchFileMetadata = async (path: string) => {
|
||||
const command = new HeadObjectCommand({
|
||||
Bucket: config.fileS3.bucketName,
|
||||
Bucket: config.storage.bucketName,
|
||||
Key: path,
|
||||
});
|
||||
|
||||
try {
|
||||
const headObject = await fileS3.send(command);
|
||||
const headObject = await s3Client.send(command);
|
||||
return {
|
||||
size: headObject.ContentLength,
|
||||
mimeType: headObject.ContentType,
|
||||
@@ -70,9 +70,9 @@ export const fetchFileMetadata = async (path: string) => {
|
||||
|
||||
export const deleteFile = async (path: string) => {
|
||||
const command = new DeleteObjectCommand({
|
||||
Bucket: config.fileS3.bucketName,
|
||||
Bucket: config.storage.bucketName,
|
||||
Key: path,
|
||||
});
|
||||
|
||||
await fileS3.send(command);
|
||||
await s3Client.send(command);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user