upgrade deps

This commit is contained in:
keyan 2022-11-06 11:28:58 -06:00
parent a1690ed511
commit 525cab2573
12 changed files with 3009 additions and 3355 deletions

View File

@ -1,6 +1,6 @@
import { ApolloClient, InMemoryCache } from '@apollo/client'
import { SchemaLink } from '@apollo/client/link/schema'
import { mergeSchemas } from 'graphql-tools'
import { makeExecutableSchema } from 'graphql-tools'
import { getSession } from 'next-auth/client'
import resolvers from './resolvers'
import typeDefs from './typeDefs'
@ -16,9 +16,9 @@ export default async function getSSRApolloClient (req, me = null) {
return new ApolloClient({
ssrMode: true,
link: new SchemaLink({
schema: mergeSchemas({
schemas: typeDefs,
resolvers: resolvers
schema: makeExecutableSchema({
typeDefs,
resolvers
}),
context: {
models,

View File

@ -38,7 +38,9 @@ export function LightningAuth ({ callbackUrl }) {
}
}`)
useEffect(createAuth, [])
useEffect(() => {
createAuth()
}, [])
if (error) return <div>error</div>

View File

@ -7,7 +7,8 @@ import { useEffect } from 'react'
export default function LnQR ({ value, webLn, statusVariant, status }) {
const qrValue = 'lightning:' + value.toUpperCase()
useEffect(async () => {
useEffect(() => {
async function effect () {
if (webLn) {
try {
const provider = await requestProvider()
@ -16,6 +17,8 @@ export default function LnQR ({ value, webLn, statusVariant, status }) {
console.log(e.message)
}
}
}
effect()
}, [])
return (

View File

@ -26,7 +26,7 @@ module.exports = withPlausibleProxy()({
return Object.keys(RuntimeSources['stacker.news'])[0]
},
// Use the CDN in production and localhost for development.
assetPrefix: isProd ? 'https://a.stacker.news' : '',
assetPrefix: isProd ? 'https://a.stacker.news' : undefined,
async headers () {
return [
{

6156
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,74 +3,79 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "NODE_OPTIONS='--trace-warnings --inspect' next dev",
"dev": "NODE_OPTIONS='--trace-warnings' next dev",
"build": "next build",
"migrate": "prisma migrate deploy",
"start": "NODE_OPTIONS='--trace-warnings' next start -p $PORT"
},
"dependencies": {
"@apollo/client": "^3.4.15",
"@opensearch-project/opensearch": "^1.0.2",
"@prisma/client": "^2.25.0",
"apollo-server-micro": "^2.21.2",
"@apollo/client": "^3.7.1",
"@opensearch-project/opensearch": "^1.1.0",
"@prisma/client": "^2.30.3",
"apollo-server-micro": "^3.11.1",
"async-retry": "^1.3.1",
"aws-sdk": "^2.1056.0",
"aws-sdk": "^2.1248.0",
"babel-plugin-inline-react-svg": "^2.0.1",
"bech32": "^2.0.0",
"bolt11": "^1.3.4",
"bootstrap": "^4.6.0",
"bolt11": "^1.4.0",
"bootstrap": "^4.6.2",
"browserslist": "^4.21.4",
"clipboard-copy": "^4.0.1",
"cross-fetch": "^3.1.5",
"domino": "^2.1.6",
"formik": "^2.2.6",
"github-slugger": "^1.4.0",
"graphql": "^15.5.0",
"github-slugger": "^1.5.0",
"graphql": "^15.8.0",
"graphql-tools": "^8.3.10",
"graphql-type-json": "^0.3.2",
"ln-service": "^54.2.1",
"jquery": "^3.6.1",
"ln-service": "^54.2.6",
"mdast-util-find-and-replace": "^1.1.1",
"mdast-util-from-markdown": "^1.2.0",
"mdast-util-to-string": "^3.1.0",
"next": "^11.1.2",
"next-auth": "^3.29.3",
"next-plausible": "^2.1.3",
"next-seo": "^4.24.0",
"nextjs-progressbar": "^0.0.13",
"micro": "^9.4.1",
"next": "^12.3.2",
"next-auth": "^3.29.10",
"next-plausible": "^3.6.4",
"next-seo": "^4.29.0",
"nextjs-progressbar": "0.0.16",
"node-s3-url-encode": "^0.0.4",
"page-metadata-parser": "^1.1.4",
"pageres": "^6.3.0",
"pg-boss": "^7.0.2",
"prisma": "^2.25.0",
"qrcode.react": "^1.0.1",
"react": "^17.0.1",
"pageres": "^7.1.0",
"pg-boss": "^7.4.0",
"popper.js": "^1.16.1",
"prisma": "^2.30.3",
"qrcode.react": "^3.1.0",
"react": "^17.0.2",
"react-avatar-editor": "^13.0.0",
"react-bootstrap": "^1.5.2",
"react-countdown": "^2.3.2",
"react-bootstrap": "^1.6.6",
"react-countdown": "^2.3.3",
"react-dom": "^17.0.2",
"react-longpressable": "^1.1.1",
"react-markdown": "^8.0.0",
"react-markdown": "^8.0.3",
"react-string-replace": "^0.4.4",
"react-syntax-highlighter": "^15.4.3",
"react-textarea-autosize": "^8.3.3",
"react-syntax-highlighter": "^15.5.0",
"react-textarea-autosize": "^8.3.4",
"react-twitter-embed": "^4.0.4",
"react-youtube": "^7.14.0",
"recharts": "^2.1.10",
"recharts": "^2.1.16",
"remark-directive": "^2.0.1",
"remark-gfm": "^3.0.1",
"remove-markdown": "^0.3.0",
"sass": "^1.32.8",
"secp256k1": "^4.0.2",
"swr": "^0.5.4",
"unist-util-visit": "^4.1.0",
"sass": "^1.56.0",
"secp256k1": "^4.0.3",
"swr": "^1.3.0",
"unist-util-visit": "^4.1.1",
"use-dark-mode": "^2.3.1",
"uuid": "^8.3.2",
"webln": "^0.2.2",
"yup": "^0.32.9"
"yup": "^0.32.11"
},
"engines": {
"node": "14.17.0"
},
"standard": {
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"plugins": [
"eslint-plugin-compat"
],
@ -82,9 +87,10 @@
}
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^7.29.0",
"eslint-plugin-compat": "^3.9.0",
"standard": "^16.0.3"
"@babel/core": "^7.20.2",
"@babel/eslint-parser": "^7.19.1",
"eslint": "^7.32.0",
"eslint-plugin-compat": "^4.0.2",
"standard": "^16.0.4"
}
}

View File

@ -42,7 +42,7 @@ function MyApp ({ Component, pageProps: { session, ...props } }) {
const client = getApolloClient()
const router = useRouter()
useEffect(async () => {
useEffect(() => {
// HACK: 'cause there's no way to tell Next to skip SSR
// So every page load, we modify the route in browser history
// to point to the same page but without SSR, ie ?nodata=true

View File

@ -1,6 +1,6 @@
import path from 'path'
import AWS from 'aws-sdk'
import {PassThrough} from 'stream'
import { PassThrough } from 'stream'
const { spawn } = require('child_process')
const encodeS3URI = require('node-s3-url-encode')
@ -9,7 +9,7 @@ const bucketRegion = 'us-east-1'
const contentType = 'image/png'
const bucketUrl = 'https://sn-capture.s3.amazonaws.com/'
const s3PathPrefix = process.env.NODE_ENV === 'development' ? 'dev/' : ''
var capturing = false
let capturing = false
AWS.config.update({
region: bucketRegion
@ -22,13 +22,13 @@ export default async function handler (req, res) {
const s3PathPUT = s3PathPrefix + (joinedPath === '.' ? '_' : joinedPath) + searchQ
const s3PathGET = s3PathPrefix + (joinedPath === '.' ? '_' : joinedPath) + encodeS3URI(searchQ)
const url = process.env.PUBLIC_URL + '/' + joinedPath + searchQ
const aws = new AWS.S3({apiVersion: '2006-03-01'})
const aws = new AWS.S3({ apiVersion: '2006-03-01' })
// check to see if we have a recent version of the object
aws.headObject({
Bucket: bucketName,
Key: s3PathPUT,
IfModifiedSince : new Date(new Date().getTime() - 15*60000)
IfModifiedSince: new Date(new Date().getTime() - 15 * 60000)
}).promise().then(() => {
// this path is cached so return it
res.writeHead(302, { Location: bucketUrl + s3PathGET }).end()
@ -37,7 +37,7 @@ export default async function handler (req, res) {
// we don't have it cached, so capture it and cache it
if (capturing) {
return res.writeHead(503, {
'Retry-After' : 1
'Retry-After': 1
}).end()
}
@ -53,7 +53,7 @@ export default async function handler (req, res) {
res.setHeader('Content-Type', contentType)
const capture = spawn(
'node', ['./spawn/capture.js', url], {maxBuffer: 1024*1024*5})
'node', ['./spawn/capture.js', url], { maxBuffer: 1024 * 1024 * 5 })
capture.on('close', code => {
if (code !== 0) {

View File

@ -51,4 +51,11 @@ export const config = {
}
}
export default apolloServer.createHandler({ path: '/api/graphql' })
const startServer = apolloServer.start()
export default async function handler (req, res) {
await startServer
await apolloServer.createHandler({
path: '/api/graphql'
})(req, res)
}

View File

@ -149,7 +149,8 @@ export function WithdrawlForm () {
const [createWithdrawl, { called, error }] = useMutation(CREATE_WITHDRAWL)
useEffect(async () => {
useEffect(() => {
async function effect () {
try {
const provider = await requestProvider()
const { paymentRequest: invoice } = await provider.makeInvoice({
@ -161,6 +162,8 @@ export function WithdrawlForm () {
} catch (e) {
console.log(e.message)
}
}
effect()
}, [])
if (called && !error) {
@ -228,15 +231,17 @@ function LnQRWith ({ k1, encodedUrl }) {
export function LnWithdrawal () {
// query for challenge
const [createAuth, { data, error }] = useMutation(gql`
mutation createAuth {
const [createWith, { data, error }] = useMutation(gql`
mutation createWith {
createWith {
k1
encodedUrl
}
}`)
useEffect(createAuth, [])
useEffect(() => {
createWith()
}, [])
if (error) return <div>error</div>

View File

@ -1,11 +1,11 @@
#!/usr/bin/node
const Pageres = require('pageres')
import Pageres from 'pageres'
async function captureUrl () {
try {
const streams = await new Pageres({ crop: true, delay: 1, scale: 2, timeout: 10, launchOptions: { args: ['--single-process'] } })
.src(process.argv[2], ['600x315'])
const streams = await new Pageres({ crop: true, scale: 2, timeout: 10, launchOptions: { args: ['--single-process'] } })
.source(process.argv[2], ['600x315'])
.run()
process.stdout.write(streams[0], () => process.exit(0))
} catch (e) {

3
spawn/package.json Normal file
View File

@ -0,0 +1,3 @@
{
"type": "module"
}