Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
botway(core): add integrations plugins, update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed May 22, 2023
1 parent 1b912c3 commit 93b08d1
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 33 deletions.
8 changes: 6 additions & 2 deletions core/app/api/integrations/add/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ export async function POST(request: Request) {

if (body.vars) {
if (body.vars.k) {
vars = `variables: {${body.vars.k}: "${body.vars.v}"}`;
vars = `variables: {${body.vars.k}: "${body.vars.v}" ${body.def_vars}}`;
} else {
vars = `variables: {${body.vars.k1}: "${body.vars.v1}" ${body.vars.k2}: "${body.vars.v2}"}`;
vars = `variables: {${body.vars.k1}: "${body.vars.v1}" ${body.vars.k2}: "${body.vars.v2}" ${body.def_vars}}`;
}
}

const query = `
mutation {
templateDeploy(input: {
${body.plugin ? `plugins: ["${body.plugin}"]` : ""}
services: [
{
hasDomain: true
Expand Down Expand Up @@ -90,6 +92,8 @@ export async function POST(request: Request) {
});

if (deploy.errors) {
console.log(deploy.errors);

return NextResponse.json({ message: deploy.errors[0].message });
}

Expand Down
8 changes: 7 additions & 1 deletion core/app/project/[id]/integrations/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ const Project = ({ user, projectId, slug }: any) => {
is_plugin: int.is_plugin,
projectId: project?.railway_project_id,
vars,
def_vars: int.def_variables,
plugin: int.plugin,
};

const newBot = await fetcher("/api/integrations/add", {
Expand Down Expand Up @@ -327,7 +329,11 @@ const Project = ({ user, projectId, slug }: any) => {
className="input"
id={`v${varx.index}`}
name={`v${varx.index}`}
type="text"
type={
varx.is_hidden
? "password"
: "text"
}
/>

<div className="pb-2" />
Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@tailwindcss/typography": "^0.5.9",
"@types/bcryptjs": "^2.4.2",
"@types/marked": "^5.0.0",
"@types/node": "^20.2.1",
"@types/node": "^20.2.3",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"@types/slug": "^5.0.3",
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/charmbracelet/lipgloss v0.7.1
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.18
github.com/mattn/go-isatty v0.0.19
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
github.com/muesli/reflow v0.3.0
github.com/muesli/termenv v0.15.1
Expand All @@ -40,7 +40,7 @@ require (
github.com/aymerick/douceur v0.2.0 // indirect
github.com/charmbracelet/glamour v0.6.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cli/browser v1.1.0 // indirect
github.com/cli/browser v1.2.0 // indirect
github.com/cli/oauth v1.0.1 // indirect
github.com/cli/safeexec v1.0.1 // indirect
github.com/cli/shurcooL-graphql v0.0.3 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38
github.com/cli/browser v1.0.0/go.mod h1:IEWkHYbLjkhtjwwWlwTHW2lGxeS5gezEQBMLTwDHf5Q=
github.com/cli/browser v1.1.0 h1:xOZBfkfY9L9vMBgqb1YwRirGu6QFaQ5dP/vXt5ENSOY=
github.com/cli/browser v1.1.0/go.mod h1:HKMQAt9t12kov91Mn7RfZxyJQQgWgyS/3SZswlZ5iTI=
github.com/cli/browser v1.2.0 h1:yvU7e9qf97kZqGFX6n2zJPHsmSObY9ske+iCvKelvXg=
github.com/cli/browser v1.2.0/go.mod h1:xFFnXLVcAyW9ni0cuo6NnrbCP75JxJ0RO7VtCBiH/oI=
github.com/cli/oauth v1.0.1 h1:pXnTFl/qUegXHK531Dv0LNjW4mLx626eS42gnzfXJPA=
github.com/cli/oauth v1.0.1/go.mod h1:qd/FX8ZBD6n1sVNQO3aIdRxeu5LGw9WhKnYhIIoC2A4=
github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
Expand Down Expand Up @@ -265,6 +267,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
Expand Down
69 changes: 42 additions & 27 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 93b08d1

Please sign in to comment.