Skip to content

Commit

Permalink
takotako
Browse files Browse the repository at this point in the history
  • Loading branch information
tako0614 authored Jun 19, 2024
1 parent c65b7a6 commit 5823a44
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 11 deletions.
7 changes: 2 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
hostname=
username=
db=
password=
MONGO_URL=mongodb://localhost:27017/takos
recaptcha_site_key=6LewIZspAAAAAEwZ8YaDMe8dxxs6F_N8KtSsukQY
rechapcha_seecret_key=6LewIZspAAAAAGJE3RjUqM4dn8jgBCx_zdcXwkwx
Expand All @@ -13,4 +9,5 @@ origin="http://localhost:8000,https://takos.jp,"
REACT_APP_RECAPTCHA_KEY=
mailDomain=http://localhost:8000
friendOrigin=http://localhost:8000?key=
REDIS_URL=redis://localhost:6379
REDIS_URL=redis://localhost:6379
wsSSL=true
4 changes: 3 additions & 1 deletion islands/Chats/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ export default function Home(
}, [talkData])
useEffect(() => {
const createWebSocket = () => {
const wssprotocol = props.wsSSL ? "wss://" : "ws://"
const wsurl = wssprotocol + "/api/v1/main"
const socket = new WebSocket(
"/api/v1/main",
wsurl
)
socket.onopen = () => {
socket.send(
Expand Down
2 changes: 2 additions & 0 deletions routes/addFriend/[roomid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useSignal } from "@preact/signals"
import User from "../../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const wsSSL = env["wsSSL"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
export const handler = {
async GET(req: any, ctx: any) {
Expand Down Expand Up @@ -103,6 +104,7 @@ export default function Home({ data }: { data: any }) {
settings={settings}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down
2 changes: 2 additions & 0 deletions routes/addFriend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useSignal } from "@preact/signals"
import User from "../../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const wsSSL = env["wsSSL"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
export const handler = {
async GET(req: any, ctx: any) {
Expand Down Expand Up @@ -86,6 +87,7 @@ export default function Home({ data }: { data: any }) {
isAddFriendForm={false}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down
2 changes: 2 additions & 0 deletions routes/home/[roomid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import User from "../../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
const wsSSL = env["wsSSL"]
export const handler = {
async GET(req: any, ctx: any) {
const { roomid } = ctx.params
Expand Down Expand Up @@ -103,6 +104,7 @@ export default function Home({ data }: { data: any }) {
settings={settings}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down
3 changes: 2 additions & 1 deletion routes/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import users from "../../models/users.ts"
import { load } from "$std/dotenv/mod.ts"
import Chat from "../../islands/Chats/Chat.tsx"
import { useSignal } from "@preact/signals"

import User from "../../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const wsSSL = env["wsSSL"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
export const handler = {
async GET(req: any, ctx: any) {
Expand Down Expand Up @@ -86,6 +86,7 @@ export default function Home({ data }: { data: any }) {
isAddFriendForm={false}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down
6 changes: 3 additions & 3 deletions routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import users from "../models/users.ts"
import { load } from "$std/dotenv/mod.ts"
import Chat from "../islands/Chats/Chat.tsx"
import { useSignal } from "@preact/signals"

import User from "../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const wsSSL = env["wsSSL"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
export const handler = {
async GET(req: any, ctx: any) {
Expand Down Expand Up @@ -89,6 +89,7 @@ export default function Home({ data }: { data: any }) {
AddFriendKey={data.key}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
)
Expand All @@ -104,5 +105,4 @@ export default function Home({ data }: { data: any }) {
)}
</>
)
}
//
}
2 changes: 2 additions & 0 deletions routes/setting/[roomid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import User from "../../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
const wsSSL = env["wsSSL"]
export const handler = {
async GET(req: any, ctx: any) {
const { roomid } = ctx.params
Expand Down Expand Up @@ -103,6 +104,7 @@ export default function Home({ data }: { data: any }) {
settings={settings}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down
3 changes: 2 additions & 1 deletion routes/setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import users from "../../models/users.ts"
import { load } from "$std/dotenv/mod.ts"
import Chat from "../../islands/Chats/Chat.tsx"
import { useSignal } from "@preact/signals"

const env = await load()
const sitekey = env["recaptcha_site_key"]
const wsSSL = env["wsSSL"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
export const handler = {
async GET(req: any, ctx: any) {
Expand Down Expand Up @@ -85,6 +85,7 @@ export default function Home({ data }: { data: any }) {
isAddFriendForm={false}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down
2 changes: 2 additions & 0 deletions routes/talk/[roomid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import User from "../../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
const wsSSL = env["wsSSL"]
export const handler = {
async GET(req: any, ctx: any) {
const { roomid } = ctx.params
Expand Down Expand Up @@ -103,6 +104,7 @@ export default function Home({ data }: { data: any }) {
settings={settings}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down
2 changes: 2 additions & 0 deletions routes/talk/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import User from "../../components/Chats/ChatUserList.jsx"
const env = await load()
const sitekey = env["recaptcha_site_key"]
const url = `https://www.google.com/recaptcha/api.js?render=${sitekey}`
const wsSSL = env["wsSSL"]
export const handler = {
async GET(req: any, ctx: any) {
const { roomid } = ctx.params
Expand Down Expand Up @@ -103,6 +104,7 @@ export default function Home({ data }: { data: any }) {
settings={settings}
userNickName={data.nickName}
userName={data.userName + "@" + env["serverDomain"]}
wsSSL={wsSSL}
>
</Chat>
</>
Expand Down

0 comments on commit 5823a44

Please sign in to comment.