This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // import { useState } from "preact/hooks"; | |
| import { useState, useEffect, useRef } from "preact/hooks"; | |
| import { Handlers, PageProps } from "$fresh/server.ts"; | |
| import UserDb from "../database.ts"; | |
| interface CreatorProps { | |
| email: string, | |
| key: string | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { cookies } from 'next/headers'; | |
| async function GetSpecCookies() { | |
| console.log('GetLitCookies is running'); | |
| const cookiesList = cookies(); | |
| const hasCookie = cookiesList.has('lit-auth') | |
| return hasCookie | |
| } | |
| export default async function Page() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Imports the Google Cloud client library | |
| const {IAMCredentialsClient} = require('@google-cloud/iam-credentials'); | |
| // TODO(developer): replace with your prefered project values. | |
| // The service account must be granted the roles/iam.serviceAccountTokenCreator role | |
| const serviceAccount = '<SERVICE ACCOUNT NAME HERE>@<PROJECT NAME HERE>.iam.gserviceaccount.com' | |
| const scopes = 'https://www.googleapis.com/auth/cloud-platform' | |
| // Creates a client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"); | |
| var app = express(); | |
| require("dotenv").config(); | |
| const GoogleAuth = require("google-auth-library").GoogleAuth; | |
| const cors = require("cors"); | |
| app.use( | |
| cors({ origin: process.env.ORIGIN, credentials: process.env.CREDENTIALS }) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logo from "./logo.svg"; | |
| import "./App.css"; | |
| import React, { useState } from "react"; | |
| import ToggleSwitch from "./ToggleSwitch"; | |
| function App() { | |
| const [resp, setResp] = useState(""); | |
| const [isToggled, setIsToggled] = useState(false); | |
| async function callApi() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Dispatch, SetStateAction } from "react"; | |
| import "./ToggleSwitch.css"; | |
| function ToggleSwitch({ toggledVal, setToggled } : { toggledVal: boolean, setToggled: Dispatch<SetStateAction<boolean>> }) { | |
| const onToggle = () => setToggled(!toggledVal); | |
| return ( | |
| <label className="toggle-switch"> | |
| <input type="checkbox" checked={toggledVal} onChange={onToggle} /> | |
| <span className="switch" /> | |
| </label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Mongo started | |
| MongoError: Authentication failed. | |
| at MessageStream.messageHandler (/var/app/node_modules/mongodb/lib/cmap/connection.js:272:20) | |
| at MessageStream.emit (events.js:400:28) | |
| at processIncomingData (/var/app/node_modules/mongodb/lib/cmap/message_stream.js:144:12) | |
| at MessageStream._write (/var/app/node_modules/mongodb/lib/cmap/message_stream.js:42:5) | |
| at writeOrBuffer (internal/streams/writable.js:358:12) | |
| at MessageStream.Writable.write (internal/streams/writable.js:303:10) | |
| at Socket.ondata (internal/streams/readable.js:731:22) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Mongo started | |
| MongoError: Authentication failed. | |
| at MessageStream.messageHandler (/var/app/node_modules/mongodb/lib/cmap/connection.js:272:20) | |
| at MessageStream.emit (node:events:513:28) | |
| at processIncomingData (/var/app/node_modules/mongodb/lib/cmap/message_stream.js:144:12) | |
| at MessageStream._write (/var/app/node_modules/mongodb/lib/cmap/message_stream.js:42:5) | |
| at writeOrBuffer (node:internal/streams/writable:391:12) | |
| at _write (node:internal/streams/writable:332:10) | |
| at MessageStream.Writable.write (node:internal/streams/writable:336:10) | |
| at Socket.ondata (node:internal/streams/readable:754:22) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require("express"); | |
| const cors = require("cors"); | |
| const litJsSdk = require("lit-js-sdk"); | |
| const app = express(); | |
| var corsOptions = { | |
| origin: "*" | |
| }; | |
| app.use(cors(corsOptions)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var router = express.Router(); | |
| router.post('/', function findAnagramsInArray(req, res) { | |
| var words = JSON.parse(JSON.stringify(req.body)); | |
| let result = {} | |
| for (const word of words) { | |
| const sorted = word.split("").sort().join(""); |