Skip to content

Commit

Permalink
fa
Browse files Browse the repository at this point in the history
  • Loading branch information
tako0614 committed Mar 5, 2024
1 parent fc77ac8 commit 0fca455
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "example-project" # 📝 Update the deploy project name if necessary
project: "dev.takoserver.com" # 📝 Update the deploy project name if necessary
entrypoint: "./main.ts" # 📝 Update the entrypoint if necessary
5 changes: 0 additions & 5 deletions a.js

This file was deleted.

16 changes: 11 additions & 5 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@
"nodeModulesDir": true,
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"preact-render-to-string": "https://esm.sh/*[email protected]",
"$std/": "https://deno.land/[email protected]/",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"@takoserver/takos-database": "jsr:@takoserver/takos-database@^0.1.0",
"preact": "https://esm.sh/[email protected]",
"preact-render-to-string": "https://esm.sh/*[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"tailwindcss": "npm:[email protected]",
"tailwindcss/": "npm:/[email protected]/",
"tailwindcss/plugin": "npm:/[email protected]/plugin.js",
"$std/": "https://deno.land/[email protected]/"
"tailwindcss/plugin": "npm:/[email protected]/plugin.js"
},
"alias": {
"react": "preact/compat",
"react-dom/test-utils": "preact/test-utils",
"react-dom": "preact/compat"
},
"compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" },
"exclude": ["**/_fresh/*"]
Expand Down
12 changes: 12 additions & 0 deletions dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ import config from "./fresh.config.ts";

import "$std/dotenv/load.ts";

import { envRoader } from "./util/takoFunction.ts";
/**connect mongoDB */
import mongoose from "npm:[email protected]";
/*
try {
mongoose.connect(
`mongodb://192.168.0.30:27017/takos`
)
} catch (error) {
console.log(error)
}*/
await dev(import.meta.url, "./main.ts", config);

13 changes: 13 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM denoland/deno:1.38.3

ARG GIT_REVISION
ENV DENO_DEPLOYMENT_ID=${GIT_REVISION}

WORKDIR /app

COPY . .
RUN deno cache main.ts

EXPOSE 8000

CMD ["run", "-A", "main.ts"]
2 changes: 1 addition & 1 deletion islands/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function RegisterForm({ text, color,tako }: { text: string, color
const handleSubmit = async (event: JSX.TargetedEvent<HTMLFormElement, Event>) => {
event.preventDefault();
const uri = new URL(window.location.href);
const token = await fetch(`${uri.protocol}//${uri.hostname}/api/token?origin=${uri.protocol}//${uri.hostname}`)
const token = await fetch(`${uri.protocol}//${uri.host}/api/token?origin=${uri.protocol}//${uri.host}`)
const csrftoken = await token.json();
const data = {
requirements: "temp_register",
Expand Down
34 changes: 9 additions & 25 deletions islands/test.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
import { h } from 'preact';
import { useState } from 'preact/hooks';


const App = () => {
const [showModal, setShowModal] = useState(false);

const handleButtonClick = () => {
setShowModal(!showModal);
}
const MyForm = () => {

return (
<div className="App">
<button onClick={handleButtonClick}>
ボタン
</button>

{showModal && (
<div className="modal">
<div className="modal-content">
<span className="close" onClick={handleButtonClick}>×</span>
<p>ここにフォームを追加します</p>
</div>
</div>
)}
</div>
<form onSubmit={handleSubmit(onSubmit)}>
<input {...register("firstName")} />
<input {...register("lastName")} />
{errors.lastName && <p>{errors.lastName.message}</p>}
<button type="submit">Submit</button>
</form>
);
}
};

export default App;
export default MyForm;

1 change: 0 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />

import "$std/dotenv/load.ts";

import { start } from "$fresh/server.ts";
Expand Down
Empty file added models/users.js
Empty file.
1 change: 0 additions & 1 deletion routes/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useSignal } from "@preact/signals";
import Header from '../components/Header.tsx'
import Footer from '../components/Footer.tsx'
import UnderMenu from '../components/UnderMenu.tsx'

// deno-lint-ignore no-explicit-any
function Developper({developerss}: {developerss: any}) {

Expand Down
10 changes: 6 additions & 4 deletions routes/api/logins/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Client } from "https://deno.land/x/[email protected]/mod.ts";
import { isMail, isUserDuplication, isMailDuplication, isMailDuplicationTemp, isCsrftoken, sendMail,client} from "../../../util/takoFunction.ts";

export const handler = {
async POST(req) {
async POST(req,res, ctx) {
const data = await req.json();
const email = await data.mail;
const CsrfToken = await data.csrftoken;
Expand All @@ -26,9 +26,10 @@ export const handler = {
}
client.query(`INSERT INTO temp_users (id,created_at,mail, kye) VALUES (default,default,"${email}",'${key}');`)
sendMail(email,"本登録を完了してください",`https://takos.jp/register?key=${key}`)
/*
return new Response(JSON.stringify({status: true}), {
headers: { "Content-Type": "application/json" },
});
});*/
} catch (error) {
return new Response(JSON.stringify({"status": "error"}), {
headers: { "Content-Type": "application/json" },
Expand All @@ -40,9 +41,10 @@ export const handler = {
});
}
}else {
return new Response(JSON.stringify({"status": "error"}), {
ctx.status(403).send({"status": "error"})
/*return new Response(JSON.stringify({"status": "error"}), {
headers: { "Content-Type": "application/json" },
});
});*/
}
} else {
return new Response(JSON.stringify({"status": "error"}), {
Expand Down
39 changes: 8 additions & 31 deletions routes/tests/form.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
import React, { useState } from "preact/compat";

const Form = () => {
const [inputValue, setInputValue] = useState("");
const [submittedValue, setSubmittedValue] = useState("");

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
setSubmittedValue(inputValue);
setInputValue("");
};

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setInputValue(event.target.value);
};

return (
<div>
<form onSubmit={handleSubmit}>
<label>
Input:
<input type="text" value={inputValue} onChange={handleChange} />
</label>
<button type="submit">Submit</button>
</form>
{submittedValue && <p>Submitted Value: {submittedValue}</p>}
</div>
);
};

export default Form;
// deno-lint-ignore-file
import Test from "../../islands/test.jsx";
export default function name() {
return <>
<Test></Test>
<div>test</div>
</>
}
Empty file added util/databaseDriver.ts
Empty file.

0 comments on commit 0fca455

Please sign in to comment.