Skip to content

Commit

Permalink
fix: revert windows ffmpeg mirror change, re-enable sidebar, changelo…
Browse files Browse the repository at this point in the history
…g, reduce verbosity of pre_build.js
  • Loading branch information
louis030195 committed Nov 8, 2024
1 parent 90d4461 commit 37e3523
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 129 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
name: Rust Style
name: Code Quality & Optimization

on: [push]

env:
CARGO_TERM_COLOR: always

jobs:
machete:
name: Cargo Machete
runs-on: ubuntu-latest
optimize:
name: Dependency & Performance Checks
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Check for unused dependencies
uses: bnjbvr/cargo-machete@main

- name: Install cargo-udeps
run: cargo install cargo-udeps --locked

- name: Run cargo-udeps
run: cargo udeps

- name: Install cargo-bloat
run: cargo install cargo-bloat

- name: Analyze binary size
run: cargo bloat --release

- name: Install cargo-audit
run: cargo install cargo-audit

- name: Security audit
run: cargo audit

- name: Install cargo-deny
run: cargo install cargo-deny

- name: Check duplicate dependencies
run: cargo deny check duplicates
200 changes: 103 additions & 97 deletions screenpipe-app-tauri/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,105 +72,111 @@ export default function Home() {
};

return (
// <SidebarProvider defaultOpen={false}>
// {settings.aiUrl && (
// <AppSidebar
// searches={searches}
// currentSearchId={currentSearchId}
// onSelectSearch={setCurrentSearchId}
// onDeleteSearch={deleteSearch}
// />
// )}
// <SidebarInset>
<div className="flex flex-col items-center flex-1">
<div className="fixed top-4 left-4 z-50 flex items-center gap-2">
{/* <SidebarTrigger className="h-8 w-8" /> */}
<Button
variant="ghost"
size="icon"
onClick={handleNewSearch}
className="h-8 w-8"
>
<Plus className="h-4 w-4" />
</Button>
</div>
<NotificationHandler />
{showOnboarding && <Onboarding />}
{/* <ChangelogDialog /> */}
<Header />
<div className="my-4" />
{settings.isLoading ? (
<div className="flex flex-col items-center justify-center h-full space-y-4">
<Skeleton className="w-[200px] h-[24px] rounded-full" />
<Skeleton className="w-[300px] h-[20px] rounded-full" />
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl">
{[...Array(5)].map((_, index) => (
<Card key={index}>
<CardContent className="p-4">
<Skeleton className="w-full h-[40px]" />
<SidebarProvider defaultOpen={false}>
{settings.aiUrl && (
<AppSidebar
searches={searches}
currentSearchId={currentSearchId}
onSelectSearch={setCurrentSearchId}
onDeleteSearch={deleteSearch}
/>
)}
<SidebarInset>
<div className="flex flex-col items-center flex-1">
<div className="fixed top-4 left-4 z-50 flex items-center gap-2">
<SidebarTrigger className="h-8 w-8" />
<Button
variant="ghost"
size="icon"
onClick={handleNewSearch}
className="h-8 w-8"
>
<Plus className="h-4 w-4" />
</Button>
</div>
<NotificationHandler />
{showOnboarding && <Onboarding />}
<ChangelogDialog />
<Header />
<div className="my-4" />
{settings.isLoading ? (
<div className="flex flex-col items-center justify-center h-full space-y-4">
<Skeleton className="w-[200px] h-[24px] rounded-full" />
<Skeleton className="w-[300px] h-[20px] rounded-full" />
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl">
{[...Array(5)].map((_, index) => (
<Card key={index}>
<CardContent className="p-4">
<Skeleton className="w-full h-[40px]" />
</CardContent>
</Card>
))}
</div>
</div>
) : settings.aiUrl ? (
<>
<div className="mb-8 text-center">
<h1 className="text-2xl font-bold text-center mb-2 flex items-center justify-center gap-3">
<span className="flex items-center gap-1">
<span className="inline-flex items-center justify-center w-7 h-7 rounded-full bg-black text-white text-sm">
1
</span>
search for a keyword
</span>
<span className="text-gray-400"></span>
<span className="flex items-center gap-1">
<span className="inline-flex items-center justify-center w-7 h-7 rounded-full bg-black text-white text-sm">
2
</span>
filter results
</span>
<span className="text-gray-400"></span>
<span className="flex items-center gap-1">
<span className="inline-flex items-center justify-center w-7 h-7 rounded-full bg-black text-white text-sm">
3
</span>
ask AI a question
</span>
</h1>
<p className="text-xl text-muted-foreground -mt-0">
where pixels become magic
</p>
</div>
<SearchChat
currentSearchId={currentSearchId}
onAddSearch={addSearch}
searches={searches}
/>
</>
) : (
<div className="flex flex-col items-center justify-center h-[calc(80vh-200px)]">
<Card className="w-[600px]">
<CardHeader>
<CardTitle>Welcome to Screenpipe playground</CardTitle>
<CardDescription>
Make sure to set your AI provider settings to ask questions
about your data.
<br />
<br />
<div className="aspect-w-16 aspect-h-9">
<iframe
src="https://www.youtube.com/embed/u2GfjvEY6tk"
title="Onboarding Video"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
className="w-full h-[300px] rounded-lg shadow-lg"
></iframe>
</div>
</CardDescription>
</CardHeader>
<CardContent>
<Settings />
</CardContent>
</Card>
))}
</div>
</div>
)}
</div>
) : settings.aiUrl ? (
<>
<div className="mb-8 text-center">
<h1 className="text-2xl font-bold text-center mb-2 flex items-center justify-center gap-3">
<span className="flex items-center gap-1">
<span className="inline-flex items-center justify-center w-7 h-7 rounded-full bg-black text-white text-sm">1</span>
search for a keyword
</span>
<span className="text-gray-400"></span>
<span className="flex items-center gap-1">
<span className="inline-flex items-center justify-center w-7 h-7 rounded-full bg-black text-white text-sm">2</span>
filter results
</span>
<span className="text-gray-400"></span>
<span className="flex items-center gap-1">
<span className="inline-flex items-center justify-center w-7 h-7 rounded-full bg-black text-white text-sm">3</span>
ask AI a question
</span>
</h1>
<p className="text-xl text-muted-foreground -mt-0">
where pixels become magic
</p>
</div>
<SearchChat
currentSearchId={currentSearchId}
onAddSearch={addSearch}
searches={searches}
/>
</>
) : (
<div className="flex flex-col items-center justify-center h-[calc(80vh-200px)]">
<Card className="w-[600px]">
<CardHeader>
<CardTitle>Welcome to Screenpipe playground</CardTitle>
<CardDescription>
Make sure to set your AI provider settings to ask questions
about your data.
<br />
<br />
<div className="aspect-w-16 aspect-h-9">
<iframe
src="https://www.youtube.com/embed/u2GfjvEY6tk"
title="Onboarding Video"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
className="w-full h-[300px] rounded-lg shadow-lg"
></iframe>
</div>
</CardDescription>
</CardHeader>
<CardContent>
<Settings />
</CardContent>
</Card>
</div>
)}
</div>
// </SidebarInset>
// </SidebarProvider>
</SidebarInset>
</SidebarProvider>
);
}
12 changes: 12 additions & 0 deletions screenpipe-app-tauri/components/changelog-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const ChangelogDialog: React.FC = () => {
<div className="max-w-max prose prose-medium prose-slate w-full h-full">
<h1>Changelog</h1>
<MemoizedReactMarkdown
// className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0"
remarkPlugins={[remarkGfm, remarkMath]}
components={{
p({ children }) {
Expand All @@ -49,6 +50,17 @@ export const ChangelogDialog: React.FC = () => {
const content = String(children).replace(/\n$/, "");
const match = /language-(\w+)/.exec(className || "");

if (!match) {
return (
<code
className="px-1 py-0.5 rounded-sm font-mono text-sm"
{...props}
>
{content}
</code>
);
}

return (
<CodeBlock
key={Math.random()}
Expand Down
4 changes: 2 additions & 2 deletions screenpipe-app-tauri/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ export default function Header() {
<Play className="mr-2 h-4 w-4" />
<span>show onboarding</span>
</DropdownMenuItem>
{/* <DropdownMenuItem
<DropdownMenuItem
className="cursor-pointer"
onClick={() => setShowChangelogDialog(true)}
>
<Folder className="mr-2 h-4 w-4" />
<span>show changelog</span>
</DropdownMenuItem> */}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
Expand Down
1 change: 0 additions & 1 deletion screenpipe-app-tauri/components/search-chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import {
TooltipTrigger,
} from "./ui/tooltip";
import { Separator } from "./ui/separator";
import { useInputHistory } from "@/lib/hooks/use-input-history";
import { ContextUsageIndicator } from "./context-usage-indicator";
import { Checkbox } from "@/components/ui/checkbox";
import { formatISO } from "date-fns";
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/components/ui/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Slot } from "@radix-ui/react-slot"
import { VariantProps, cva } from "class-variance-authority"
import { PanelLeft } from "lucide-react"

import { useIsMobile } from "@/hooks/use-mobile"
import { useIsMobile } from "@/lib/hooks/use-mobile"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
Expand Down
File renamed without changes.
27 changes: 11 additions & 16 deletions screenpipe-app-tauri/scripts/pre_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const mkdirp = async (dir) => await fs.mkdir(dir, { recursive: true });
const config = {
ffmpegRealname: 'ffmpeg',
windows: {
ffmpegName: 'ffmpeg-7.0.2-full_build-shared',
ffmpegUrl: 'https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-7.0.2-full_build-shared.7z',
ffmpegName: 'ffmpeg-7.0-windows-desktop-vs2022-default',
ffmpegUrl: 'https://unlimited.dl.sourceforge.net/project/avbuild/windows-desktop/ffmpeg-7.0-windows-desktop-vs2022-default.7z?viasf=1',
vcpkgPackages: ['opencl', 'onnxruntime-gpu'],
},
linux: {
Expand Down Expand Up @@ -317,6 +317,7 @@ if (platform == 'windows') {
await $`'C:\\Program Files\\7-Zip\\7z.exe' x ${config.windows.ffmpegName}.7z`
await $`mv ${config.windows.ffmpegName} ${config.ffmpegRealname}`
await $`rm -rf ${config.windows.ffmpegName}.7z`
await $`mv ${config.ffmpegRealname}/lib/x64/* ${config.ffmpegRealname}/lib/`
}

// Setup ONNX Runtime
Expand Down Expand Up @@ -448,8 +449,8 @@ if (platform == 'macos') {

try {
if (await fs.exists('screenpipe-aarch64-apple-darwin')) {
// Get existing rpaths
const otoolOutput = await $`otool -l ./screenpipe-aarch64-apple-darwin`.catch(() => ({ stdout: '' }));
// Get existing rpaths but suppress detailed output
const otoolOutput = await $`otool -l ./screenpipe-aarch64-apple-darwin`.quiet();
const rpathRegex = /LC_RPATH.*?\n.*?path\s+(.*?)\s/gs;
const existingRpaths = [];
let match;
Expand All @@ -459,13 +460,9 @@ if (platform == 'macos') {
existingRpaths.push(match[1]);
}

console.log('existing rpaths:', existingRpaths);

// Remove existing rpaths
// Remove existing rpaths silently
for (const rpath of existingRpaths) {
await $`install_name_tool -delete_rpath "${rpath}" ./screenpipe-aarch64-apple-darwin`.catch(() => {
console.log(`note: couldn't delete rpath ${rpath}`);
});
await $`install_name_tool -delete_rpath "${rpath}" ./screenpipe-aarch64-apple-darwin`.quiet();
}

// Add the rpaths we need
Expand All @@ -478,9 +475,7 @@ if (platform == 'macos') {
];

for (const rpath of rpathsToAdd) {
await $`install_name_tool -add_rpath "${rpath}" ./screenpipe-aarch64-apple-darwin`.catch(() => {
console.log(`note: couldn't add rpath ${rpath}`);
});
await $`install_name_tool -add_rpath "${rpath}" ./screenpipe-aarch64-apple-darwin`.quiet();
}

// Update the dylib reference
Expand All @@ -498,9 +493,9 @@ if (platform == 'macos') {
console.error(`${dylib} not found at ${dyLibSrc}`);
}

console.log('verifying final configuration:');
await $`otool -L ./screenpipe-aarch64-apple-darwin`;
await $`otool -l ./screenpipe-aarch64-apple-darwin | grep -A2 LC_RPATH`;
// console.log('verifying final configuration:');
// await $`otool -L ./screenpipe-aarch64-apple-darwin`;
// await $`otool -l ./screenpipe-aarch64-apple-darwin | grep -A2 LC_RPATH`;
}
} catch (error) {
console.error('error updating dylib paths:', error);
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 37e3523

Please sign in to comment.