Prepare cast for deployment from this same repo - Part 1 (#1638)

This commit is contained in:
Manav Rathi 2024-02-20 11:09:52 +05:30 committed by GitHub
commit d5a2e7822b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 34 additions and 274 deletions

2
.gitignore vendored
View file

@ -4,9 +4,11 @@ node_modules/
# Next.js
.next/
out/
next-env.d.ts
# macOS
.DS_Store
# Local env files
.env
.env.*.local

View file

@ -1,36 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

View file

@ -1,40 +0,0 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

View file

@ -1,13 +1,10 @@
{
"name": "accounts",
"version": "0.1.0",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"export": "next export"
"build": "next build"
},
"dependencies": {},
"devDependencies": {

View file

@ -1,3 +1,3 @@
import { initSentry } from '@ente/shared/sentry/config/sentry.config.base';
initSentry('https://bd3656fc40d74d5e8f278132817963a3@sentry.ente.io/2');
initSentry('https://cbed7333f2810fbbdb692dcd76d8ca1a@sentry.ente.io/2');

View file

@ -1,3 +1,6 @@
defaults.url=https://sentry.ente.io/
defaults.org=ente
defaults.project=photos-web
# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
# SENTRY_AUTH_TOKEN environment variable is defined.
defaults.url = https://sentry.ente.io/
defaults.org = ente
defaults.project = photos-web

View file

@ -1,5 +0,0 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View file

@ -1,11 +1,9 @@
{
"name": "auth",
"version": "0.0.1",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"lint": "next lint",
"export": "next export"
"build": "next build"
}
}

View file

View file

@ -1,3 +1,6 @@
defaults.url=https://sentry.ente.io/
defaults.org=ente
defaults.project=auth-web
# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
# SENTRY_AUTH_TOKEN environment variable is defined.
defaults.url = https://sentry.ente.io/
defaults.org = ente
defaults.project = auth-web

36
apps/cast/.gitignore vendored
View file

@ -1,36 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

View file

@ -1,40 +0,0 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

View file

@ -1,53 +0,0 @@
const cp = require('child_process');
const { getIsSentryEnabled } = require('./sentryConfigUtil');
module.exports = {
WEB_SECURITY_HEADERS: {
'Strict-Transport-Security': ' max-age=63072000',
'X-Content-Type-Options': 'nosniff',
'X-Download-Options': 'noopen',
'X-Frame-Options': 'deny',
'X-XSS-Protection': '1; mode=block',
'Referrer-Policy': 'same-origin',
},
CSP_DIRECTIVES: {
// self is safe enough
'default-src': "'self'",
// data to allow two factor qr code
'img-src': "'self' blob: data: https://*.openstreetmap.org",
'media-src': "'self' blob:",
'manifest-src': "'self'",
'style-src': "'self' 'unsafe-inline'",
'font-src ': "'self'; script-src 'self' 'unsafe-eval' blob:",
'connect-src':
"'self' https://*.ente.io http://localhost:8080 data: blob: https://ente-prod-eu.s3.eu-central-003.backblazeb2.com https://ente-prod-v3.s3.eu-central-2.wasabisys.com/ https://ente-staging-eu.s3.eu-central-003.backblazeb2.com/ ws://localhost:3000/",
'base-uri ': "'self'",
// to allow worker
'child-src': "'self' blob:",
'object-src': "'none'",
'frame-ancestors': " 'none'",
'form-action': "'none'",
'report-uri': ' https://csp-reporter.ente.io/local',
'report-to': ' https://csp-reporter.ente.io/local',
'script-src-elem': "'self' https://www.gstatic.com",
},
ALL_ROUTES: '/(.*)',
buildCSPHeader: (directives) => ({
'Content-Security-Policy-Report-Only': Object.entries(
directives
).reduce((acc, [key, value]) => acc + `${key} ${value};`, ''),
}),
convertToNextHeaderFormat: (headers) =>
Object.entries(headers).map(([key, value]) => ({ key, value })),
getGitSha: () =>
cp.execSync('git rev-parse --short HEAD', {
cwd: __dirname,
encoding: 'utf8',
}),
getIsSentryEnabled: getIsSentryEnabled,
};

View file

@ -1,13 +1,10 @@
{
"name": "cast",
"version": "0.1.0",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"export": "next export"
"build": "next build"
},
"dependencies": {
"mime-types": "^2.1.35",

View file

@ -1,2 +0,0 @@
import { setupSentry } from '@ente/shared/sentry/config/sentry.config.base';
setupSentry('https://bd3656fc40d74d5e8f278132817963a3@sentry.ente.io/2');

View file

@ -0,0 +1,3 @@
import { initSentry } from '@ente/shared/sentry/config/sentry.config.base';
initSentry('https://cbed7333f2810fbbdb692dcd76d8ca1a@sentry.ente.io/2');

View file

View file

@ -1,3 +1,6 @@
defaults.url=https://sentry.ente.io/
defaults.org=ente
defaults.project=photos-web
# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
# SENTRY_AUTH_TOKEN environment variable is defined.
defaults.url = https://sentry.ente.io/
defaults.org = ente
defaults.project = photos-web

View file

View file

@ -1,11 +0,0 @@
const ENV_DEVELOPMENT = 'development';
module.exports.getIsSentryEnabled = () => {
if (process.env.NEXT_PUBLIC_SENTRY_ENV === ENV_DEVELOPMENT) {
return false;
} else if (process.env.NEXT_PUBLIC_DISABLE_SENTRY === 'true') {
return false;
} else {
return true;
}
};

View file

@ -1,15 +0,0 @@
export const ENV_DEVELOPMENT = 'development';
export const ENV_PRODUCTION = 'production';
export const getSentryDSN = () =>
process.env.NEXT_PUBLIC_SENTRY_DSN ??
'https://bd3656fc40d74d5e8f278132817963a3@sentry.ente.io/2';
export const getSentryENV = () =>
process.env.NEXT_PUBLIC_SENTRY_ENV ?? ENV_PRODUCTION;
export const getSentryRelease = () => process.env.SENTRY_RELEASE;
export { getIsSentryEnabled } from '../../sentryConfigUtil';
export const isDEVSentryENV = () => getSentryENV() === ENV_DEVELOPMENT;

View file

@ -1,5 +0,0 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View file

@ -1,12 +1,10 @@
{
"name": "photos",
"version": "1.0.0",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"lint": "next lint",
"build": "next build",
"export": "next export",
"albums": "next dev -p 3002"
},
"dependencies": {

View file

@ -1,5 +1,5 @@
# This file is used by the SentryWebpackPlugin to upload sourcemaps (if the
# SENTRY_AUTH_TOKEN environment variable is defined).
# This file is used by the SentryWebpackPlugin to upload sourcemaps when the
# SENTRY_AUTH_TOKEN environment variable is defined.
defaults.url = https://sentry.ente.io/
defaults.org = ente

View file

@ -26,8 +26,7 @@ export const loadSender = (() => {
window.__onGCastApiAvailable = (isAvailable) => {
if (isAvailable) {
cast.framework.CastContext.getInstance().setOptions({
receiverApplicationId:
process.env.NEXT_PUBLIC_CAST_APP_ID,
receiverApplicationId: 'F5BCEC64',
autoJoinPolicy:
chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
});