Skip to content

Commit

Permalink
fix: crash at boot
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Aug 1, 2024
1 parent 4655c6a commit 59d274a
Show file tree
Hide file tree
Showing 11 changed files with 1,708 additions and 315 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,6 @@
# # Run for Linux
# act -W .github/workflows/release-app.yml --container-architecture linux/amd64 -j publish-tauri -P ubuntu-24.04

# Manual release instructions for Mac:

# VERSION=app-0.1.0
# git tag $VERSION
# git push origin $VERSION
# gh release create $VERSION --generate-notes
# export TAURI_SIGNING_PRIVATE_KEY="..."
# export TAURI_SIGNING_PRIVATE_KEY_PASSWORD="..."
# export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
# export PKG_CONFIG_ALLOW_CROSS=1
# For M1 (aarch64-apple-darwin):
# cargo build --release --features metal --target aarch64-apple-darwin
# cd examples/apps/screenpipe-app-tauri
# bun scripts/pre_build.js
# bun tauri build --target aarch64-apple-darwin -- --features metal
# tar -czf screenpipe-${VERSION}-aarch64-apple-darwin.tar.gz -C ../target/aarch64-apple-darwin/release/bundle/dmg screenpipe_0.1.0_aarch64.dmg
# gh release upload ${VERSION} screenpipe-${VERSION}-aarch64-apple-darwin.tar.gz
# rm screenpipe-${VERSION}-aarch64-apple-darwin.tar.gz
#
# For Intel (x86_64-apple-darwin):
# cd ../../..
# cargo build --release --features metal --target x86_64-apple-darwin
# cd examples/apps/screenpipe-app-tauri
# bun scripts/pre_build.js
# bun tauri build --target x86_64-apple-darwin -- --features metal
# tar -czf screenpipe-${VERSION}-x86_64-apple-darwin.tar.gz -C ../target/x86_64-apple-darwin/release/bundle/dmg screenpipe_0.1.0_x64.dmg
# gh release upload ${VERSION} screenpipe-${VERSION}-x86_64-apple-darwin.tar.gz
# rm screenpipe-${VERSION}-x86_64-apple-darwin.tar.gz
#

name: Release App

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"screenpipe-vision",
"screenpipe-audio",
"screenpipe-server",

]
exclude = [
"examples/apps/screenpipe-app-tauri/src-tauri",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
const handleStop = async () => {
setIsStopping(true);
try {
await invoke("use_cli", { useCli: true });
await invoke("kill_all_sreenpipes");
await new Promise((resolve) => setTimeout(resolve, 2000));
await fetchHealth();
} catch (error) {
Expand All @@ -107,7 +107,7 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
const handleStart = async () => {
setIsStarting(true);
try {
await invoke("use_cli", { useCli: false });
await invoke("spawn_screenpipe");
await new Promise((resolve) => setTimeout(resolve, 2000));
await fetchHealth();
} catch (error) {
Expand Down
120 changes: 0 additions & 120 deletions examples/apps/screenpipe-app-tauri/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ import { spinner } from "./spinner";
export function Settings({ className }: { className?: string }) {
const { settings, updateSettings } = useSettings();
const [localSettings, setLocalSettings] = React.useState(settings);
const [isTogglingCli, setIsTogglingCli] = React.useState(false);
const [isTogglingCliError, setIsTogglingCliError] = React.useState("");
const [isStopping, setIsStopping] = useState(false);
const [isStarting, setIsStarting] = useState(false);

console.log("localSettings", localSettings);
console.log("settings", settings);

const handleApiKeyChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setLocalSettings({ ...localSettings, openaiApiKey: e.target.value });
Expand All @@ -55,31 +48,6 @@ export function Settings({ className }: { className?: string }) {
updateSettings({ ...localSettings, useOllama: checked });
};

const handleStop = async () => {
setIsStopping(true);
try {
await invoke("use_cli", { useCli: true });
await new Promise((resolve) => setTimeout(resolve, 2000));
} catch (error) {
console.error("Failed to stop:", error);
// Handle error
} finally {
setIsStopping(false);
}
};
const handleStart = async () => {
setIsStarting(true);
try {
await invoke("use_cli", { useCli: false });
await new Promise((resolve) => setTimeout(resolve, 2000));
} catch (error) {
console.error("Failed to start:", error);
// Handle error
} finally {
setIsStarting(false);
}
};

React.useEffect(() => {
setLocalSettings(settings);
}, [settings]);
Expand Down Expand Up @@ -244,94 +212,6 @@ export function Settings({ className }: { className?: string }) {
</TooltipProvider>
</CardContent>
</Card>

<Separator />

<Card>
<CardHeader>
<CardTitle className="text-center">CLI Option</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="flex items-center justify-center space-x-4">
{/* <Switch
id="use-cli"
checked={localSettings.useCli}
onCheckedChange={handleCliToggle}
disabled={isTogglingCli}
/> */}
<Label
htmlFor="use-cli"
className="flex items-center space-x-2"
>
Use screenpipe as a CLI
<Badge variant="destructive" className="ml-2">
Experimental
</Badge>
<Badge variant="outline" className="ml-1">
Expert Only
</Badge>
</Label>
</div>
<p className="text-sm text-center text-muted-foreground">
By default, we run screenpipe in the background for you. Use
this option only if the status message keep showing red/error
even after restart.
</p>
<div className="flex justify-between mt-2 w-1/2 mx-auto">
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="outline"
size="sm"
className="flex-1 mr-1"
onClick={handleStop}
disabled={isStopping || isStarting}
>
{isStopping ? spinner : null}
{isStopping ? "Stopping..." : "Stop"}
</Button>
</TooltipTrigger>
<TooltipContent>
<p>This will kill any screenpipe instance running</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>

<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="outline"
size="sm"
className="flex-1 ml-1"
onClick={handleStart}
disabled={isStopping || isStarting}
>
{isStarting ? spinner : null}
{isStarting ? "Starting..." : "Start"}
</Button>
</TooltipTrigger>
<TooltipContent>
<p>
This will start a screenpipe instance in the background
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<p className="text-sm text-center text-muted-foreground">
Press stop then copy and paste this in your terminal and press
enter:
</p>
<CodeBlock
language="bash"
value={`brew tap louis030195/screen-pipe https://github.com/louis030195/screen-pipe.git
brew install screenpipe
screenpipe`}
/>
</CardContent>
</Card>
</div>
</DialogContent>
</Dialog>
Expand Down
6 changes: 5 additions & 1 deletion examples/apps/screenpipe-app-tauri/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
const nextConfig = {
output: 'export',
}
import { withSentryConfig } from '@sentry/nextjs';

export default nextConfig;
// Wrap the Next.js configuration with Sentry
// module.exports = withSentryConfig(nextConfig);

export default withSentryConfig(nextConfig);
1 change: 1 addition & 0 deletions examples/apps/screenpipe-app-tauri/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
"@sentry/nextjs": "^8.21.0",
"@tauri-apps/api": "^2.0.0-beta.15",
"@tauri-apps/plugin-cli": "2.0.0-beta.7",
"@tauri-apps/plugin-fs": "2.0.0-beta.7",
Expand Down
Loading

0 comments on commit 59d274a

Please sign in to comment.