Skip to content

Commit

Permalink
refactor: remove legacy whatsapp social
Browse files Browse the repository at this point in the history
  • Loading branch information
outaTiME committed Feb 22, 2024
1 parent 711a135 commit 7120044
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 260 deletions.
7 changes: 0 additions & 7 deletions .yarn/patches/fluent-ffmpeg-npm-2.1.2-692c218f68.patch

This file was deleted.

79 changes: 0 additions & 79 deletions .yarn/patches/whatsapp-web.js-https-a2405ef4ed.patch

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
},
"packageManager": "[email protected]",
"resolutions": {
"babel-plugin-lodash/@babel/types": "~7.20.0",
"fluent-ffmpeg@npm:2.1.2": "patch:fluent-ffmpeg@npm%3A2.1.2#~/.yarn/patches/fluent-ffmpeg-npm-2.1.2-692c218f68.patch"
"babel-plugin-lodash/@babel/types": "~7.20.0"
}
}
5 changes: 1 addition & 4 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
"object-hash": "^3.0.0",
"pretty-ms": "^9.0.0",
"puppeteer-core": "~21.9.0",
"qrcode-terminal": "^0.12.0",
"reddit": "^1.2.1",
"semver": "^7.6.0",
"sharp": "^0.32.6",
"twitter-api-v2": "^1.16.0",
"whatsapp-web.js": "patch:whatsapp-web.js@https%3A//github.com/alechkos/whatsapp-web.js.git%23commit=bc250c7e99ec36f98865240413c5d50da8d512ae#~/.yarn/patches/whatsapp-web.js-https-a2405ef4ed.patch",
"wwebjs-aws-s3": "^1.0.2"
"twitter-api-v2": "^1.16.0"
}
}
133 changes: 0 additions & 133 deletions packages/api/src/libs/social/whatsapp-legacy.js

This file was deleted.

3 changes: 0 additions & 3 deletions sst.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ export default {
BSKY_PASSWORD: process.env.BSKY_PASSWORD,
WHATSAPP_CHANNEL_ID: process.env.WHATSAPP_CHANNEL_ID,
WHAPI_TOKEN: process.env.WHAPI_TOKEN,
// https://pptr.dev/api/puppeteer.configuration
// PUPPETEER_SKIP_DOWNLOAD: 'true',
STORE_DEBUG: 'true',
// https://aws.amazon.com/es/blogs/compute/node-js-18-x-runtime-now-available-in-aws-lambda/
// NODE_OPTIONS: '--no-experimental-fetch',
// prevents experimental warnings from buffer.File
Expand Down
37 changes: 5 additions & 32 deletions stacks/MainStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import * as s3 from 'aws-cdk-lib/aws-s3';
import { SubscriptionFilter } from 'aws-cdk-lib/aws-sns';
import { Api, Function, StaticSite, Topic, Cron } from 'sst/constructs';

export function MainStack({ stack /*, app */ }) {
export function MainStack({ stack }) {
const IS_PRODUCTION = stack.stage === 'prod';
// const IS_LOCAL = app.local === true;
// existing resources
const bucket = s3.Bucket.fromBucketName(
stack,
Expand Down Expand Up @@ -227,22 +226,14 @@ export function MainStack({ stack /*, app */ }) {
SOCIAL_SCREENSHOT_URL: screenshotSite.url,
},
handler: 'packages/api/src/subscribers/social-notify.handler',
layers: [
process.env.CHROME_LAYER_ARN,
process.env.SHARP_LAYER_ARN,
// process.env.WWEBJS_LAYER_ARN,
],
layers: [process.env.CHROME_LAYER_ARN, process.env.SHARP_LAYER_ARN],
nodejs: {
esbuild: {
external: [
'@sparticuz/chromium',
'sharp',
// 'whatsapp-web.js'
],
external: ['@sparticuz/chromium', 'sharp'],
},
},
// ~2m
timeout: '4 minutes',
// ~60s
timeout: '2 minutes',
},
cdk: {
subscription: {
Expand Down Expand Up @@ -313,21 +304,6 @@ export function MainStack({ stack /*, app */ }) {
}),
},
});
/* const createWhatsAppSessionFn =
IS_LOCAL &&
new Function(stack, 'CreateWhatsAppSession', {
handler: 'packages/api/src/libs/social/whatsapp.handler',
layers: [process.env.CHROME_LAYER_ARN, process.env.WWEBJS_LAYER_ARN],
nodejs: {
esbuild: {
external: ['@sparticuz/chromium', 'whatsapp-web.js'],
},
},
permissions: [bucket],
// ~2m
timeout: '4 minutes',
url: true,
}); */
// trace stack
stack.addOutputs({
ApiUrl: api.url,
Expand All @@ -340,8 +316,5 @@ export function MainStack({ stack /*, app */ }) {
...(legacyApi.cdk.domainName && {
LegacyApiRegionalDomainName: legacyApi.cdk.domainName.regionalDomainName,
}),
/* ...(createWhatsAppSessionFn && {
CreateWhatsAppSession: createWhatsAppSessionFn.url,
}), */
});
}

0 comments on commit 7120044

Please sign in to comment.