Skip to content

Commit

Permalink
publish: v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ugo-studio committed Jun 20, 2024
1 parent 84f2fd2 commit b8f69c6
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 26 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Tauri + SvelteKit + TypeScript
# FileStream

This template should help get you started developing with Tauri, SvelteKit and TypeScript in Vite.
Sharing files across the devices on the same local network

## Recommended IDE Setup

[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
Binary file modified bin/server/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filestream",
"version": "0.0.0",
"version": "1.0.2",
"description": "",
"type": "module",
"scripts": {
Expand Down
25 changes: 20 additions & 5 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { execFileSync } from "child_process";
import { rename } from "fs/promises";
import { existsSync } from "fs";
import { readdir, rename, rm } from "fs/promises";

let extension = "";
if (process.platform === "win32") {
Expand All @@ -12,10 +13,24 @@ async function main() {
if (!targetTriple) {
console.error("Failed to determine platform target triple");
}
await rename(
`src-tauri/bin/server${extension}`,
`src-tauri/bin/server-${targetTriple}${extension}`
);
const bins = await readdir(`src-tauri/bin`, { encoding: "utf8" });
bins.sort((a, b) => b.length - a.length);
console.log(bins);
for (let bin of bins) {
const strs = bin.split(".");
if (strs.length > 1) strs.pop();
bin = strs.join(".");

const oldPath = `src-tauri/bin/${bin}${extension}`;
const newPath = `src-tauri/bin/${bin}-${targetTriple}${extension}`;

if (bin.includes(targetTriple)) {
await rm(oldPath, { recursive: true, maxRetries: 3 });
} else {
await rename(oldPath, newPath);
console.log(`renamed file: ${oldPath} --> ${newPath}`);
}
}
}

main().catch((e) => {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2021"
tauri-build = { version = "1", features = [] }

[dependencies]
tauri = { version = "1", features = [ "fs-all", "shell-all", "dialog-all"] }
tauri = { version = "1", features = [ "shell-sidecar", "shell-open", "dialog-all"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"

Expand Down
5 changes: 3 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "filestream",
"version": "1.0.1"
"version": "1.0.2"
},
"tauri": {
"allowlist": {
Expand Down Expand Up @@ -50,6 +50,7 @@
"identifier": "com.ugo.studio.file.stream",
"shortDescription": "filestream | file sharing app",
"longDescription": "filestream | file sharing app",
"publisher": "ugoStudio",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand All @@ -62,4 +63,4 @@
]
}
}
}
}
27 changes: 15 additions & 12 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
let showQr = false;
onMount(() => {
startServer();
timer = setInterval(() => {
if (server.stat == FileServerStat.closed) startServer();
}, 1000);
startServer();
}, 6000);
});
onDestroy(() => {
Expand Down Expand Up @@ -48,18 +49,20 @@
});
const startServer = async () => {
if (!server.serverAddr) {
await process?.kill();
let info = await startProcess();
if (info && info.network && info.port) {
let serverAddr = `http://${info.network}:${info.port}`;
let shareAddr = `${serverAddr}/?s=${encodeURIComponent(serverAddr)}`;
server.serverAddr = serverAddr;
server.shareAddr = shareAddr;
console.log(info, serverAddr, shareAddr);
if (server.stat === FileServerStat.closed) {
if (!server.serverAddr) {
await process?.kill();
let info = await startProcess();
if (info && info.network && info.port) {
let serverAddr = `http://${info.network}:${info.port}`;
let shareAddr = `${serverAddr}/?s=${encodeURIComponent(serverAddr)}`;
server.serverAddr = serverAddr;
server.shareAddr = shareAddr;
console.log(info, serverAddr, shareAddr);
}
}
server.connect();
}
server.connect();
};
</script>

Expand Down

0 comments on commit b8f69c6

Please sign in to comment.