Docker static html and model open fix

This commit is contained in:
2026-04-05 12:46:21 -04:00
parent 5a438fa5c8
commit 1cd3444ef1
4 changed files with 37 additions and 27 deletions
+1
View File
@@ -23,5 +23,6 @@ RUN apk add --no-cache libgcc sqlite-libs openssl
COPY --from=frontend-builder /app/build /app/build COPY --from=frontend-builder /app/build /app/build
COPY --from=backend-builder /app/server/target/release/server /app/server COPY --from=backend-builder /app/server/target/release/server /app/server
ENV PORT=3000 ENV PORT=3000
ENV STATIC_DIR=/app/build
EXPOSE 3000 EXPOSE 3000
CMD ["/app/server"] CMD ["/app/server"]
+7 -1
View File
@@ -53,12 +53,14 @@ CREATE TABLE IF NOT EXISTS files (
id TEXT PRIMARY KEY, id TEXT PRIMARY KEY,
owner_id TEXT NOT NULL, owner_id TEXT NOT NULL,
document_id TEXT, document_id TEXT,
folder_id TEXT,
name TEXT NOT NULL, name TEXT NOT NULL,
mime_type TEXT NOT NULL, mime_type TEXT NOT NULL,
data BLOB NOT NULL, data BLOB NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(owner_id) REFERENCES users(id), FOREIGN KEY(owner_id) REFERENCES users(id),
FOREIGN KEY(document_id) REFERENCES documents(id) FOREIGN KEY(document_id) REFERENCES documents(id),
FOREIGN KEY(folder_id) REFERENCES folders(id)
); );
"#, "#,
) )
@@ -76,5 +78,9 @@ CREATE TABLE IF NOT EXISTS files (
.execute(&pool) .execute(&pool)
.await; .await;
let _ = sqlx::query("ALTER TABLE files ADD COLUMN folder_id TEXT REFERENCES folders(id)")
.execute(&pool)
.await;
pool pool
} }
+3 -1
View File
@@ -84,10 +84,12 @@ async fn main() {
let yjs_routes = Router::new() let yjs_routes = Router::new()
.route("/{id}", get(yjs_handler)); .route("/{id}", get(yjs_handler));
let static_dir = std::env::var("STATIC_DIR").unwrap_or_else(|_| "../build".to_string());
let app = Router::new() let app = Router::new()
.nest("/api", api_routes.layer(TraceLayer::new_for_http())) .nest("/api", api_routes.layer(TraceLayer::new_for_http()))
.nest("/yjs", yjs_routes.layer(TraceLayer::new_for_http())) .nest("/yjs", yjs_routes.layer(TraceLayer::new_for_http()))
.fallback_service(ServeDir::new("../build").fallback(ServeFile::new("../build/index.html"))) .fallback_service(ServeDir::new(&static_dir).fallback(ServeFile::new(format!("{}/index.html", static_dir))))
.with_state(state); .with_state(state);
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000") let listener = tokio::net::TcpListener::bind("0.0.0.0:3000")
+26 -25
View File
@@ -422,31 +422,6 @@
</div> </div>
{/if} {/if}
{#if showShareModal && shareTarget}
<ShareModal docId={shareTarget.id} onClose={() => showShareModal = false} />
{/if}
{#if showDeleteModal && deleteTarget}
<DeleteModal {deleteTarget} {confirmDelete} onClose={() => showDeleteModal = false} />
{/if}
{#if showInfoModal && selectedInfo}
<InfoModal {selectedInfo} onClose={() => showInfoModal = false} />
{/if}
{#if showRenameModal}
<RenameModal initialTitle={renameTitle} {handleRename} onClose={() => showRenameModal = false} />
{/if}
{#if showCreateModal}
<CreateDocModal {createDoc} onClose={() => showCreateModal = false} />
{/if}
{#if showCreateFolderModal}
<CreateFolderModal {createFolder} onClose={() => showCreateFolderModal = false} />
{/if}
{#if documents.length > 0 || files.length > 0} {#if documents.length > 0 || files.length > 0}
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6"> <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
@@ -474,6 +449,32 @@
</div> </div>
{/if} {/if}
{/if} {/if}
{#if showShareModal && shareTarget}
<ShareModal docId={shareTarget.id} onClose={() => showShareModal = false} />
{/if}
{#if showDeleteModal && deleteTarget}
<DeleteModal {deleteTarget} {confirmDelete} onClose={() => showDeleteModal = false} />
{/if}
{#if showInfoModal && selectedInfo}
<InfoModal {selectedInfo} onClose={() => showInfoModal = false} />
{/if}
{#if showRenameModal}
<RenameModal initialTitle={renameTitle} {handleRename} onClose={() => showRenameModal = false} />
{/if}
{#if showCreateModal}
<CreateDocModal {createDoc} onClose={() => showCreateModal = false} />
{/if}
{#if showCreateFolderModal}
<CreateFolderModal {createFolder} onClose={() => showCreateFolderModal = false} />
{/if}
</main> </main>
<Footer sticky={false} /> <Footer sticky={false} />