Compare commits
No commits in common. "2ced092aa4360ec16222c48677a8ba5544fb6b89" and "757d790e5460c41c425f2af746889484ea6d23f3" have entirely different histories.
2ced092aa4
...
757d790e54
5 changed files with 27 additions and 47 deletions
23
README.md
23
README.md
|
@ -49,30 +49,23 @@ To get started with li'l Judd, follow the instructions below.
|
||||||
VITE_DISCORD_CLIENT=your_discord_client_id
|
VITE_DISCORD_CLIENT=your_discord_client_id
|
||||||
VITE_DISCORD_CLIENT_SECRET=your_discord_client_secret
|
VITE_DISCORD_CLIENT_SECRET=your_discord_client_secret
|
||||||
VITE_DISCORD_BOT_TOKEN=your_discord_bot_token
|
VITE_DISCORD_BOT_TOKEN=your_discord_bot_token
|
||||||
VITE_DISCORD_BOT_PERMISSIONS=18977581952080
|
|
||||||
|
|
||||||
VITE_AUTH_SECRET=your_auth_secret
|
VITE_AUTH_SECRET=your_auth_secret
|
||||||
|
|
||||||
VITE_DATABASE_URL=your_database_url
|
VITE_DATABASE_URL=your_database_url
|
||||||
```
|
```
|
||||||
|
|
||||||
Recieve your discord applications client id & secret, as well as the bot token from the [Applications dashboard](https://discord.com/developers/applications/).
|
#### Development
|
||||||
|
|
||||||
How to generate your `VITE_AUTH_SECRET` with [`openssl rand -base64 32`](https://authjs.dev/reference/core#secret).
|
Specify `VITE_AUTH_REDIRECT_PROXY_URL` only if necessary, particularly when setting up a reverse proxy to test authentication with callbacks to your development box. [Auth.js Docs Reference](https://authjs.dev/reference/nextjs/#redirectproxyurl)
|
||||||
|
|
||||||
Composite your `VITE_DATABASE_URL` like [`postgres://postgres:adminadmin@0.0.0.0:5432/db`](https://orm.drizzle.team/docs/get-started-postgresql#postgresjs).
|
The duplicate `DATABASE_URL` is only needed for Drizzle Studio.
|
||||||
|
|
||||||
#### Development
|
```
|
||||||
|
VITE_AUTH_REDIRECT_PROXY_URL=your_auth_redirect_proxy_url
|
||||||
|
|
||||||
Specify `VITE_AUTH_REDIRECT_PROXY_URL` only if necessary, particularly when setting up a reverse proxy to test authentication with callbacks to your development box. [Auth.js Docs Reference](https://authjs.dev/reference/nextjs/#redirectproxyurl)
|
DATABASE_URL=your_database_url
|
||||||
|
```
|
||||||
The duplicate `DATABASE_URL` is only needed for Drizzle Studio.
|
|
||||||
|
|
||||||
```
|
|
||||||
VITE_AUTH_REDIRECT_PROXY_URL=your_auth_redirect_proxy_url
|
|
||||||
|
|
||||||
DATABASE_URL=your_database_url
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
@ -127,6 +120,6 @@ If you'd like to contribute to li'l Judd, feel free to open an issue or submit a
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the [GPL v3 License](LICENSE).
|
This project is licensed under the [MIT License](LICENSE).
|
||||||
|
|
||||||
Happy splatting! 🦑🎮
|
Happy splatting! 🦑🎮
|
||||||
|
|
|
@ -40,7 +40,7 @@ function NavBar() {
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="flex-row responsive thick">
|
<ul class="flex-row responsive thick">
|
||||||
<Li
|
<Li
|
||||||
href={`https://discord.com/api/oauth2/authorize?client_id=${import.meta.env.VITE_DISCORD_CLIENT_ID}&permissions=${import.meta.env.VITE_DISCORD_BOT_PERMISSIONS}&scope=bot`}
|
href="https://discord.com/api/oauth2/authorize?client_id=1024410658973941862&permissions=18977581952080&scope=bot"
|
||||||
name="Invite to your server"
|
name="Invite to your server"
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon class="lower" icon={faCirclePlus} size="xl" />
|
<FontAwesomeIcon class="lower" icon={faCirclePlus} size="xl" />
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import type { AdapterAccount } from "@auth/core/adapters";
|
import type { AdapterAccount } from "@auth/core/adapters";
|
||||||
import { relations } from "drizzle-orm";
|
import { relations } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
boolean,
|
|
||||||
integer,
|
integer,
|
||||||
pgTable,
|
pgTable,
|
||||||
primaryKey,
|
primaryKey,
|
||||||
|
@ -72,7 +71,7 @@ export const matchPlannings = pgTable("match_planning", {
|
||||||
roleId: varchar("role_id", { length: 20 }).notNull(),
|
roleId: varchar("role_id", { length: 20 }).notNull(),
|
||||||
opponentName: varchar("opponent_name", { length: 100 }).notNull(),
|
opponentName: varchar("opponent_name", { length: 100 }).notNull(),
|
||||||
messageId: varchar("message_id", { length: 20 }).notNull(),
|
messageId: varchar("message_id", { length: 20 }).notNull(),
|
||||||
utc_ts: timestamp("utc_ts").notNull(),
|
ts: timestamp("ts").notNull(),
|
||||||
guildId: varchar("guild_id", { length: 20 })
|
guildId: varchar("guild_id", { length: 20 })
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => guilds.id, { onDelete: "cascade" }),
|
.references(() => guilds.id, { onDelete: "cascade" }),
|
||||||
|
@ -108,7 +107,6 @@ export const timePlannings = pgTable("time_planning", {
|
||||||
}),
|
}),
|
||||||
channelId: varchar("channel_id", { length: 20 }).notNull(),
|
channelId: varchar("channel_id", { length: 20 }).notNull(),
|
||||||
target_interval: smallint("target_interval").notNull(),
|
target_interval: smallint("target_interval").notNull(),
|
||||||
roles: boolean("roles").notNull(),
|
|
||||||
isAvailableRoleId: varchar("is_available_role_id", { length: 20 }),
|
isAvailableRoleId: varchar("is_available_role_id", { length: 20 }),
|
||||||
wantsToBeNotifieRoledId: varchar("wants_to_be_notified_role_id", {
|
wantsToBeNotifieRoledId: varchar("wants_to_be_notified_role_id", {
|
||||||
length: 20,
|
length: 20,
|
||||||
|
|
|
@ -98,10 +98,9 @@ const getPayload = async (
|
||||||
function config() {
|
function config() {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const navigator = useNavigate();
|
const navigator = useNavigate();
|
||||||
let [timezoneRef, setTimezoneRef] = createSignal<HTMLInputElement>();
|
let timezoneRef: HTMLInputElement;
|
||||||
let [timePlanningRef, setTimePlanningRef] = createSignal<HTMLInputElement>();
|
let timePlanningRef: HTMLInputElement;
|
||||||
let [pingableRolesRef, setPingableRolesRef] =
|
let pingableRolesRef: HTMLInputElement;
|
||||||
createSignal<HTMLInputElement>();
|
|
||||||
|
|
||||||
const [timezone, setTimezone] = createSignal(guessTZ());
|
const [timezone, setTimezone] = createSignal(guessTZ());
|
||||||
const [payload] = createResource(params.guildId, async (id) => {
|
const [payload] = createResource(params.guildId, async (id) => {
|
||||||
|
@ -137,21 +136,14 @@ function config() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => (timezoneRef.value = timezone()));
|
||||||
const ref = timezoneRef();
|
createEffect(
|
||||||
if (!ref) return;
|
() => (timePlanningRef.checked = config.features.timePlanning.enabled),
|
||||||
ref.value = timezone();
|
);
|
||||||
});
|
createEffect(
|
||||||
createEffect(() => {
|
() =>
|
||||||
const ref = timePlanningRef();
|
(pingableRolesRef.checked = config.features.timePlanning.pingableRoles),
|
||||||
if (!ref) return;
|
);
|
||||||
ref.checked = config.features.timePlanning.enabled;
|
|
||||||
});
|
|
||||||
createEffect(() => {
|
|
||||||
const ref = pingableRolesRef();
|
|
||||||
if (!ref) return;
|
|
||||||
ref.checked = config.features.timePlanning.pingableRoles;
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout site="config">
|
<Layout site="config">
|
||||||
|
@ -163,9 +155,8 @@ function config() {
|
||||||
class="guildpfp"
|
class="guildpfp"
|
||||||
src={
|
src={
|
||||||
guild()?.icon
|
guild()?.icon
|
||||||
? `https://cdn.discordapp.com/icons/${guild()?.id}/${
|
? `https://cdn.discordapp.com/icons/${guild()?.id}/${guild()
|
||||||
guild()?.icon
|
?.icon}.webp?size=240`
|
||||||
}.webp?size=240`
|
|
||||||
: "https://cdn.discordapp.com/icons/1040502664506646548/bb5a51c4659cf47bdd942bb11e974da7.webp?size=240"
|
: "https://cdn.discordapp.com/icons/1040502664506646548/bb5a51c4659cf47bdd942bb11e974da7.webp?size=240"
|
||||||
}
|
}
|
||||||
alt="Server pfp"
|
alt="Server pfp"
|
||||||
|
@ -183,7 +174,7 @@ function config() {
|
||||||
type="text"
|
type="text"
|
||||||
list="timezones"
|
list="timezones"
|
||||||
id="timezone"
|
id="timezone"
|
||||||
ref={(e) => setTimezoneRef(e)}
|
ref={timezoneRef!}
|
||||||
// disabled={!tzNames().find((e) => e === timezone())}
|
// disabled={!tzNames().find((e) => e === timezone())}
|
||||||
onInput={(e) => setTimezone(e.target.value)}
|
onInput={(e) => setTimezone(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
@ -220,7 +211,7 @@ function config() {
|
||||||
hidden
|
hidden
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="timePlanning"
|
id="timePlanning"
|
||||||
ref={(e) => setTimePlanningRef(e)}
|
ref={timePlanningRef!}
|
||||||
onInput={(e) =>
|
onInput={(e) =>
|
||||||
setConfig("features", "timePlanning", "enabled", e.target.checked)
|
setConfig("features", "timePlanning", "enabled", e.target.checked)
|
||||||
}
|
}
|
||||||
|
@ -255,7 +246,7 @@ function config() {
|
||||||
hidden
|
hidden
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="pingableRoles"
|
id="pingableRoles"
|
||||||
ref={(e) => setPingableRolesRef(e)}
|
ref={pingableRolesRef!}
|
||||||
onInput={(e) =>
|
onInput={(e) =>
|
||||||
setConfig(
|
setConfig(
|
||||||
"features",
|
"features",
|
||||||
|
|
4
src/types/env.d.ts
vendored
4
src/types/env.d.ts
vendored
|
@ -1,10 +1,9 @@
|
||||||
/// <reference types="vinxi/client" />
|
/// <reference types="vinxi/client" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_DISCORD_CLIENT_ID: string;
|
readonly VITE_DISCORD_CLIENT: string;
|
||||||
readonly VITE_DISCORD_CLIENT_SECRET: string;
|
readonly VITE_DISCORD_CLIENT_SECRET: string;
|
||||||
readonly VITE_DISCORD_BOT_TOKEN: string;
|
readonly VITE_DISCORD_BOT_TOKEN: string;
|
||||||
readonly VITE_DISCORD_BOT_PERMISSIONS: string;
|
|
||||||
|
|
||||||
readonly VITE_AUTH_SECRET: string;
|
readonly VITE_AUTH_SECRET: string;
|
||||||
readonly VITE_AUTH_REDIRECT_PROXY_URL: string | undefined;
|
readonly VITE_AUTH_REDIRECT_PROXY_URL: string | undefined;
|
||||||
|
@ -12,7 +11,6 @@ interface ImportMetaEnv {
|
||||||
readonly VITE_DATABASE_URL: string;
|
readonly VITE_DATABASE_URL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
readonly env: ImportMetaEnv;
|
readonly env: ImportMetaEnv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue