Formatting
This commit is contained in:
@@ -10,7 +10,9 @@ app.use(cors())
|
||||
const invocationURL = (port) =>
|
||||
`http://localhost:${port}/2015-03-31/functions/function/invocations`
|
||||
|
||||
const makeRequest = (route, port) => [route, async (req, res) => {
|
||||
const makeRequest = (route, port) => [
|
||||
route,
|
||||
async (req, res) => {
|
||||
console.log(`making post request to ${port}, ${route}`)
|
||||
try {
|
||||
const { data } = await axios.post(invocationURL(port), {
|
||||
@@ -22,7 +24,8 @@ const makeRequest = (route, port) => [route, async (req, res) => {
|
||||
res.status(500)
|
||||
res.send()
|
||||
}
|
||||
}]
|
||||
},
|
||||
]
|
||||
|
||||
app.post(...makeRequest('/openscad/preview', 5052))
|
||||
app.post(...makeRequest('/openscad/stl', 5053))
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
const { makeFile, runCommand } = require('../common/utils')
|
||||
const { nanoid } = require('nanoid')
|
||||
|
||||
module.exports.runCQ = async ({ file, settings: {
|
||||
deflection = 0.3
|
||||
} = {} } = {}) => {
|
||||
module.exports.runCQ = async ({
|
||||
file,
|
||||
settings: { deflection = 0.3 } = {},
|
||||
} = {}) => {
|
||||
const tempFile = await makeFile(file, '.py', nanoid)
|
||||
const fullPath = `/tmp/${tempFile}/output.stl`
|
||||
const command = `cq-cli/cq-cli --codec stl --infile /tmp/${tempFile}/main.py --outfile ${fullPath} --outputopts "deflection:${deflection};angularDeflection:${deflection};"`
|
||||
|
||||
@@ -57,7 +57,7 @@ const unWrappedHandler = async (req, _context) => {
|
||||
const user = body.user
|
||||
const email = user.email
|
||||
|
||||
let roles = []
|
||||
const roles = []
|
||||
|
||||
if (eventType === 'signup') {
|
||||
roles.push('user')
|
||||
|
||||
@@ -15,42 +15,49 @@ interface SuccessResult {
|
||||
messageSize: number
|
||||
response: string
|
||||
envelope: {
|
||||
from: string | false,
|
||||
from: string | false
|
||||
to: string[]
|
||||
},
|
||||
}
|
||||
messageId: string
|
||||
}
|
||||
|
||||
export function sendMail({to, from, subject, text}: Args): Promise<SuccessResult> {
|
||||
let transporter = nodemailer.createTransport({
|
||||
export function sendMail({
|
||||
to,
|
||||
from,
|
||||
subject,
|
||||
text,
|
||||
}: Args): Promise<SuccessResult> {
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'smtp.mailgun.org',
|
||||
port: 587,
|
||||
secure: false,
|
||||
tls: {
|
||||
ciphers:'SSLv3'
|
||||
ciphers: 'SSLv3',
|
||||
},
|
||||
auth: {
|
||||
user: 'postmaster@mail.cadhub.xyz',
|
||||
pass: process.env.EMAIL_PASSWORD
|
||||
}
|
||||
});
|
||||
pass: process.env.EMAIL_PASSWORD,
|
||||
},
|
||||
})
|
||||
|
||||
console.log({to, from, subject, text});
|
||||
console.log({ to, from, subject, text })
|
||||
|
||||
const emailPromise = new Promise((resolve, reject) => {
|
||||
transporter.sendMail({
|
||||
transporter.sendMail(
|
||||
{
|
||||
from,
|
||||
to,
|
||||
subject,
|
||||
text,
|
||||
}, (error, info) => {
|
||||
},
|
||||
(error, info) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
reject(error)
|
||||
} else {
|
||||
resolve(info);
|
||||
resolve(info)
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
}) as any as Promise<SuccessResult>
|
||||
return emailPromise
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ const Footer = () => {
|
||||
>
|
||||
Road Map
|
||||
</OutBound>
|
||||
<OutBound
|
||||
className="mr-8"
|
||||
to="https://learn.cadhub.xyz/blog"
|
||||
>
|
||||
<OutBound className="mr-8" to="https://learn.cadhub.xyz/blog">
|
||||
Blog
|
||||
</OutBound>
|
||||
<Link className="mr-8" to={routes.codeOfConduct()}>
|
||||
|
||||
@@ -13,7 +13,7 @@ import { requestRender } from 'src/helpers/hooks/useIdeState'
|
||||
import texture from './dullFrontLitMetal.png'
|
||||
import { TextureLoader } from 'three/src/loaders/TextureLoader'
|
||||
|
||||
const loader = new TextureLoader
|
||||
const loader = new TextureLoader()
|
||||
const colorMap = loader.load(texture)
|
||||
|
||||
extend({ OrbitControls })
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
export const render = async ({ code }) => {
|
||||
const body = JSON.stringify({
|
||||
settings: {
|
||||
deflection: 0.2
|
||||
deflection: 0.2,
|
||||
},
|
||||
file: code,
|
||||
})
|
||||
|
||||
@@ -21,17 +21,35 @@ const AdminEmailPage = () => {
|
||||
},
|
||||
})
|
||||
|
||||
const sendEmail = () => sendEmailMutation({ variables: { email: { subject, body } } })
|
||||
const sendEmail = () =>
|
||||
sendEmailMutation({ variables: { email: { subject, body } } })
|
||||
|
||||
return (
|
||||
<div className="flex justify-center">
|
||||
<div className="max-w-7xl pt-8">
|
||||
<h2 className="" style={{width: '46rem'}}>Email all users</h2>
|
||||
<h2 className="" style={{ width: '46rem' }}>
|
||||
Email all users
|
||||
</h2>
|
||||
<label htmlFor="subject">Subject</label>
|
||||
<input name="subject" className="rounded border border-gray-400 px-2 w-full" value={subject} onChange={({target}) => setSubject(target.value)}/>
|
||||
<input
|
||||
name="subject"
|
||||
className="rounded border border-gray-400 px-2 w-full"
|
||||
value={subject}
|
||||
onChange={({ target }) => setSubject(target.value)}
|
||||
/>
|
||||
<label htmlFor="body">Body</label>
|
||||
<textarea className="w-full rounded border border-gray-400 p-2" name="text" value={body} onChange={({target}) => setBody(target.value)}></textarea>
|
||||
<button className="rounded px-2 p-1 mt-4 bg-ch-purple-400 text-indigo-200" onClick={sendEmail}>Send</button>
|
||||
<textarea
|
||||
className="w-full rounded border border-gray-400 p-2"
|
||||
name="text"
|
||||
value={body}
|
||||
onChange={({ target }) => setBody(target.value)}
|
||||
></textarea>
|
||||
<button
|
||||
className="rounded px-2 p-1 mt-4 bg-ch-purple-400 text-indigo-200"
|
||||
onClick={sendEmail}
|
||||
>
|
||||
Send
|
||||
</button>
|
||||
</div>
|
||||
<Toaster timeout={1500} />
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import SubjectAccessRequestsCell from 'src/components/SubjectAccessRequestsCell'
|
||||
import { Flash, useQuery, useMutation, useFlash } from '@redwoodjs/web'
|
||||
import { useQuery, useMutation } from '@redwoodjs/web'
|
||||
import { Form, Submit } from '@redwoodjs/forms'
|
||||
|
||||
import MainLayout from 'src/layouts/MainLayout'
|
||||
|
||||
Reference in New Issue
Block a user