Skip to content

Commit

Permalink
feat: screenshot route fix
Browse files Browse the repository at this point in the history
  • Loading branch information
richiemcilroy committed Nov 23, 2024
1 parent 11079ae commit 08db3fa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ jobs:
echo "NEXT_PUBLIC_URL=${{ secrets.NEXT_PUBLIC_URL }}" >> .env
echo 'NEXTAUTH_URL=${NEXT_PUBLIC_URL}' >> .env
echo 'VITE_SERVER_URL=${NEXT_PUBLIC_URL}' >> .env
echo "NEXT_PUBLIC_CAP_AWS_REGION=${{ secrets.NEXT_PUBLIC_CAP_AWS_REGION }}" >> .env
echo "NEXT_PUBLIC_CAP_AWS_BUCKET=${{ secrets.NEXT_PUBLIC_CAP_AWS_BUCKET }}" >> .env
- name: Copy .env to apps/desktop
run: cp .env apps/desktop/.env

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
echo "NEXT_PUBLIC_ENVIRONMENT=production" >> .env
echo "NEXT_PUBLIC_LOCAL_MODE=false" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env
echo "NEXT_PUBLIC_CAP_AWS_REGION=${{ secrets.NEXT_PUBLIC_CAP_AWS_REGION }}" >> .env
echo "NEXT_PUBLIC_CAP_AWS_BUCKET=${{ secrets.NEXT_PUBLIC_CAP_AWS_BUCKET }}" >> .env
- name: Copy .env to apps/desktop
run: cp .env apps/desktop/.env
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ jobs:
echo "NEXT_PUBLIC_URL=${{ secrets.NEXT_PUBLIC_URL }}" >> .env
echo 'NEXTAUTH_URL=${NEXT_PUBLIC_URL}' >> .env
echo 'VITE_SERVER_URL=${NEXT_PUBLIC_URL}' >> .env
echo "NEXT_PUBLIC_CAP_AWS_REGION=${{ secrets.NEXT_PUBLIC_CAP_AWS_REGION }}" >> .env
echo "NEXT_PUBLIC_CAP_AWS_BUCKET=${{ secrets.NEXT_PUBLIC_CAP_AWS_BUCKET }}" >> .env
- name: Copy .env to apps/desktop
run: cp .env apps/desktop/.env

Expand Down
6 changes: 4 additions & 2 deletions apps/desktop/src-tauri/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ impl S3UploadMeta {

pub fn ensure_defaults(&mut self) {
if self.aws_region.is_empty() {
self.aws_region = std::env::var("NEXT_PUBLIC_CAP_AWS_REGION").unwrap_or_default();
self.aws_region = std::env::var("NEXT_PUBLIC_CAP_AWS_REGION")
.unwrap_or_else(|_| "us-east-1".to_string());
}
if self.aws_bucket.is_empty() {
self.aws_bucket = std::env::var("NEXT_PUBLIC_CAP_AWS_BUCKET").unwrap_or_default();
self.aws_bucket =
std::env::var("NEXT_PUBLIC_CAP_AWS_BUCKET").unwrap_or_else(|_| "capso".to_string());
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions apps/web/app/api/screenshot/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export async function GET(request: NextRequest) {
}

const result = query[0];
if (!result?.video || !result?.bucket) {
if (!result?.video) {
return new Response(
JSON.stringify({ error: true, message: "Video or bucket not found" }),
JSON.stringify({ error: true, message: "Video not found" }),
{ status: 401, headers: getHeaders(origin) }
);
}
Expand Down Expand Up @@ -113,7 +113,6 @@ export async function GET(request: NextRequest) {
headers: getHeaders(origin),
});
} catch (error) {
console.error("Error generating screenshot URL", error);
return new Response(
JSON.stringify({
error: error,
Expand Down

1 comment on commit 08db3fa

@vercel
Copy link

@vercel vercel bot commented on 08db3fa Nov 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.