Docker static html and model open fix
This commit is contained in:
@@ -23,5 +23,6 @@ RUN apk add --no-cache libgcc sqlite-libs openssl
|
||||
COPY --from=frontend-builder /app/build /app/build
|
||||
COPY --from=backend-builder /app/server/target/release/server /app/server
|
||||
ENV PORT=3000
|
||||
ENV STATIC_DIR=/app/build
|
||||
EXPOSE 3000
|
||||
CMD ["/app/server"]
|
||||
|
||||
+7
-1
@@ -53,12 +53,14 @@ CREATE TABLE IF NOT EXISTS files (
|
||||
id TEXT PRIMARY KEY,
|
||||
owner_id TEXT NOT NULL,
|
||||
document_id TEXT,
|
||||
folder_id TEXT,
|
||||
name TEXT NOT NULL,
|
||||
mime_type TEXT NOT NULL,
|
||||
data BLOB NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
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)
|
||||
.await;
|
||||
|
||||
let _ = sqlx::query("ALTER TABLE files ADD COLUMN folder_id TEXT REFERENCES folders(id)")
|
||||
.execute(&pool)
|
||||
.await;
|
||||
|
||||
pool
|
||||
}
|
||||
|
||||
+3
-1
@@ -84,10 +84,12 @@ async fn main() {
|
||||
let yjs_routes = Router::new()
|
||||
.route("/{id}", get(yjs_handler));
|
||||
|
||||
let static_dir = std::env::var("STATIC_DIR").unwrap_or_else(|_| "../build".to_string());
|
||||
|
||||
let app = Router::new()
|
||||
.nest("/api", api_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);
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000")
|
||||
|
||||
@@ -422,31 +422,6 @@
|
||||
</div>
|
||||
{/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}
|
||||
<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>
|
||||
{/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>
|
||||
|
||||
<Footer sticky={false} />
|
||||
|
||||
Reference in New Issue
Block a user