Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4311569
feat: set lang in html head
Huskydog9988 Jun 5, 2025
9f4bd67
fix: add # in front of git ref
Huskydog9988 Jun 6, 2025
3e26657
fix: remove unused vars from example env
Huskydog9988 Jun 6, 2025
0ba9cb8
fix: package name and license field
Huskydog9988 Jun 6, 2025
7ec4c40
fix: enable sourcemap for client and server
Huskydog9988 Jun 7, 2025
e87cd8e
fix: emojis not showing in prod
Huskydog9988 Jun 7, 2025
097405c
Merge branch 'develop' into i18n-fixes
Huskydog9988 Jun 7, 2025
36b4cdd
chore: refactor auth manager
Huskydog9988 Jun 7, 2025
bbc8a4a
feat: disable invitations if simple auth disabled
Huskydog9988 Jun 7, 2025
99d87a3
feat: add drop version to footer
Huskydog9988 Jun 7, 2025
5f34967
feat: translate auth endpoints
Huskydog9988 Jun 7, 2025
cdaba48
chore: move oidc module
Huskydog9988 Jun 7, 2025
11042ab
feat: add weekly tasks
Huskydog9988 Jun 7, 2025
6b8adc1
feat: add timestamp to task log msgs
Huskydog9988 Jun 7, 2025
d513b62
feat: add guard to prevent invalid progress %
Huskydog9988 Jun 7, 2025
6d182a3
fix: add missing global scope to i18n components
Huskydog9988 Jun 7, 2025
c85777e
feat: set base url for i18n
Huskydog9988 Jun 7, 2025
99c5f69
feat: switch task log to json format
Huskydog9988 Jun 8, 2025
cacdaed
Merge branch 'develop' into i18n-fixes
Huskydog9988 Jun 8, 2025
7da8a1d
ci: run ci on develop branch only
Huskydog9988 Jun 8, 2025
bb23bd8
fix: UserWidget text not updating #109
Huskydog9988 Jun 8, 2025
440c927
fix: EXTERNAL_URL being computed at build
Huskydog9988 Jun 8, 2025
aed8957
Merge branch 'develop' into i18n-fixes
Huskydog9988 Jun 8, 2025
b53a3bb
feat: add basic language outlines for translation
Huskydog9988 Jun 8, 2025
abbb4c0
feat: add more english dialects
Huskydog9988 Jun 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
DATABASE_URL="postgres://drop:drop@127.0.0.1:5432/drop"

CLIENT_CERTIFICATES="./.data/ca"

FS_BACKEND_PATH="./.data/objects"

GIANT_BOMB_API_KEY=""

EXTERNAL_URL="localhost:3000"
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CI

on: [pull_request, push]
on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
typecheck:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
],
"i18n-ally.extract.ignoredByFiles": {
"pages/admin/library/sources/index.vue": ["Filesystem"],
"components/NewsArticleCreateButton.vue": ["[", "`", "Enter"]
"components/NewsArticleCreateButton.vue": ["[", "`", "Enter"],
"server/api/v1/auth/signin/simple.post.ts": ["boolean | undefined"]
}
}
4 changes: 1 addition & 3 deletions components/EmojiText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const props = defineProps<{
emoji: string;
}>();

const emojiEl = ref<HTMLElement | null>(null);

const url = computed(() => {
return `/api/v1/emojis/${twemoji.convert.toCodePoint(props.emoji)}.svg`;
return `/twemoji/${twemoji.convert.toCodePoint(props.emoji)}.svg`;
});
</script>
59 changes: 45 additions & 14 deletions components/LanguageSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
class="grid w-full cursor-default grid-cols-1 rounded-md bg-zinc-900 py-1.5 pr-2 pl-3 text-left text-zinc-300 outline-1 -outline-offset-1 outline-zinc-700 focus:outline-2 focus:-outline-offset-2 focus:outline-blue-600 sm:text-sm/6"
>
<span class="col-start-1 row-start-1 flex items-center gap-3 pr-6">
<span alt="" class="-mt-0.5 shrink-0 rounded-full">{{
localeToEmoji(wiredLocale)
}}</span>
<EmojiText
:emoji="localeToEmoji(wiredLocale)"
class="-mt-0.5 shrink-0 max-w-6"
/>
<span class="block truncate">{{
currentLocaleInformation?.name ?? wiredLocale
}}</span>
Expand Down Expand Up @@ -46,9 +47,10 @@
]"
>
<div class="flex items-center">
<span class="-mt-0.5 shrink-0 rounded-full">
{{ localeToEmoji(listLocale.code) }}
</span>
<EmojiText
:emoji="localeToEmoji(listLocale.code)"
class="-mt-0.5 shrink-0 max-w-6"
/>
<span
:class="[
selected ? 'font-semibold' : 'font-normal',
Expand Down Expand Up @@ -106,21 +108,50 @@ import {
} from "@headlessui/vue";
import { ChevronUpDownIcon } from "@heroicons/vue/16/solid";
import { ArrowTopRightOnSquareIcon } from "@heroicons/vue/24/outline";
import type { Locale } from "vue-i18n";

const { locales, locale: currLocale, setLocale } = useI18n();

const { locales, locale, setLocale } = useI18n();
function changeLocale(locale: Locale) {
setLocale(locale);

// dynamically update the HTML attributes for language and direction
// this is necessary for proper rendering of the page in the new language
useHead({
htmlAttrs: {
lang: locale,
dir: locales.value.find((l) => l.code === locale)?.dir || "ltr",
},
});
}

function localeToEmoji(local: string): string {
switch (local) {
// Default locale
case "en":
case "en-us":
return "🇺🇸";

case "en-gb":
return "🇬🇧";
case "en-ca":
return "🇨🇦";
case "en-au":
case "en-us": {
return "🇺🇸";
}
case "en-pirate": {
return "🇦🇺";
case "en-pirate":
return "🏴‍☠️";
}
case "fr":
return "🇫🇷";
case "de":
return "🇩🇪";
case "es":
return "🇪🇸";
case "it":
return "🇮🇹";
case "zh":
return "🇨🇳";
case "zh-tw":
return "🇹🇼";

default: {
return "❓";
Expand All @@ -130,10 +161,10 @@ function localeToEmoji(local: string): string {

const wiredLocale = computed({
get() {
return locale.value;
return currLocale.value;
},
set(v) {
setLocale(v);
changeLocale(v);
},
});
const currentLocaleInformation = computed(() =>
Expand Down
20 changes: 20 additions & 0 deletions components/UserFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<footer class="bg-zinc-950" aria-labelledby="footer-heading">
<h2 id="footer-heading" class="sr-only">{{ $t("footer.footer") }}</h2>
<div class="mx-auto max-w-7xl px-6 py-16 sm:py-24 lg:px-8">
<!-- Drop Info -->
<div class="xl:grid xl:grid-cols-3 xl:gap-8">
<div class="space-y-8">
<DropWordmark class="h-10" />
Expand All @@ -24,6 +25,8 @@
</NuxtLink>
</div>
</div>

<!-- Foot links -->
<div class="mt-16 grid grid-cols-2 gap-8 xl:col-span-2 xl:mt-0">
<div class="md:grid md:grid-cols-2 md:gap-8">
<div>
Expand Down Expand Up @@ -86,6 +89,21 @@
</div>
</div>
</div>

<div class="flex items-center justify-center xl:col-span-3 mt-8">
<p
class="text-xs text-zinc-700 hover:text-zinc-400 transition-colors duration-200 cursor-default select-none"
>
<i18n-t keypath="footer.version" tag="p" scope="global">
<template #version>
<span>{{ versionInfo.version }}</span>
</template>
<template #gitRef>
<span>{{ versionInfo.gitRef }}</span>
</template>
</i18n-t>
</p>
</div>
</div>
</div>
</footer>
Expand All @@ -96,6 +114,8 @@ import { IconsDiscordLogo, IconsGithubLogo } from "#components";

const { t } = useI18n();

const versionInfo = await $dropFetch("/api/v1");

const navigation = {
games: [
{ name: t("store.recentlyAdded"), href: "#" },
Expand Down
31 changes: 16 additions & 15 deletions components/UserHeader/UserWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,21 @@ import { useObject } from "~/composables/objects";
import type { NavigationItem } from "~/composables/types";

const user = useUser();
const { t } = useI18n();

const navigation: NavigationItem[] = [
user.value?.admin
? {
label: t("userHeader.profile.admin"),
route: "/admin",
prefix: "",
}
: undefined,
{
label: t("userHeader.profile.settings"),
route: "/account",
prefix: "",
},
].filter((e) => e !== undefined);
const navigation = computed<NavigationItem[]>(() =>
[
user.value?.admin
? {
label: $t("userHeader.profile.admin"),
route: "/admin",
prefix: "",
}
: undefined,
{
label: $t("userHeader.profile.settings"),
route: "/account",
prefix: "",
},
].filter((e) => e !== undefined),
);
</script>
8 changes: 8 additions & 0 deletions i18n/i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ export default defineI18nConfig(() => {
// https://vue-i18n.intlify.dev/guide/essentials/datetime.html
datetimeFormats: {
"en-us": defaultDateTimeFormat,
"en-gb": defaultDateTimeFormat,
"en-au": defaultDateTimeFormat,
"en-pirate": defaultDateTimeFormat,
fr: defaultDateTimeFormat,
de: defaultDateTimeFormat,
it: defaultDateTimeFormat,
es: defaultDateTimeFormat,
zh: defaultDateTimeFormat,
"zh-tw": defaultDateTimeFormat,
},
};
});
1 change: 1 addition & 0 deletions i18n/locales/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/locales/en_au.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/locales/en_gb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
41 changes: 14 additions & 27 deletions i18n/locales/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@
"listItemPlaceholder": "list item"
},
"errors": {
"auth": {
"method": {
"signinDisabled": "Sign in method not enabled"
},
"invalidUserOrPass": "Invalid username or password.",
"disabled": "Invalid or disabled account. Please contact the server administrator.",
"invalidPassState": "Invalid password state. Please contact the server administrator.",
"inviteIdRequired": "id required in fetching invitation",
"invalidInvite": "Invalid or expired invitation",
"usernameTaken": "Username already taken."
},
"backHome": "{arrow} Back to home",
"invalidBody": "Invalid request body: {0}",
"inviteRequired": "Invitation required to sign up.",
Expand Down Expand Up @@ -201,7 +212,8 @@
"discord": "Discord",
"github": "GitHub"
},
"topSellers": "Top Sellers"
"topSellers": "Top Sellers",
"version": "Drop {version} {gitRef}"
},
"header": {
"admin": {
Expand All @@ -218,17 +230,14 @@
"admin": {
"description": "Manage the users on your Drop instance, and configure your authentication methods.",
"authLink": "Authentication {arrow}",

"displayNameHeader": "Display Name",
"usernameHeader": "Username",
"emailHeader": "Email",
"adminHeader": "Admin?",
"authoptionsHeader": "Auth Options",
"srEditLabel": "Edit",

"adminUserLabel": "Admin user",
"normalUserLabel": "Normal user",

"authentication": {
"title": "Authentication",
"description": "Drop supports a variety of \"authentication mechanisms\". As you enable or disable them, they are shown on the sign in screen for users to select from. Click the dot menu to configure the authentication mechanism.",
Expand All @@ -237,47 +246,33 @@
"disabled": "Disabled",
"srOpenOptions": "Open options",
"configure": "Configure",

"simple": "Simple (username/password)",
"oidc": "OpenID Connect"
},

"simple": {
"title": "Simple authentication",
"description": "Simple authentication uses a system of 'invitations' to create users. You can create an invitation, and optionally specify a username or email for the user, and then it will generate a magic URL that can be used to create an account.",

"invitationTitle": "invitations",
"createInvitation": "Create invitation",

"noUsernameEnforced": "No username enforced.",
"noEmailEnforced": "No email enforced.",

"adminInvitation": "Admin invitation",
"userInvitation": "User invitation",

"expires": "Expires: {expiry}",
"neverExpires": "Never expires.",

"noInvitations": "No invitations.",

"inviteTitle": "Invite user to Drop",
"inviteDescription": "Drop will generate a URL that you can send to the person you want to invite. You can optionally specify a username or email for them to use.",

"inviteUsernameLabel": "Username (optional)",
"inviteUsernameFormat": "Must be 5 or more characters",
"inviteUsernamePlaceholder": "myUsername",

"inviteEmailLabel": "Email address (optional)",
"inviteEmailDescription": "Must be in the format user{'@'}example.com",
"inviteEmailPlaceholder": "me{'@'}example.com",

"inviteAdminSwitchLabel": "Admin invitation",
"inviteAdminSwitchDescription": "Create this user as an administrator",

"inviteExpiryLabel": "Expires",

"inviteButton": "Invite",

"invite3Days": "3 days",
"inviteWeek": "1 week",
"inviteMonth": "1 month",
Expand Down Expand Up @@ -347,18 +342,14 @@
"imageCarouselEmpty": "No images added to the carousel yet.",
"removeImageCarousel": "Remove image",
"addCarouselNoImages": "No images to add.",

"imageLibrary": "Image library",
"imageLibraryDescription": "Please note all images uploaded are accessible to all users through browser dev-tools.",
"setBanner": "Set as banner",
"setCover": "Set as cover",
"deleteImage": "Delete image",

"currentBanner": "banner",
"currentCover": "cover",

"addDescriptionNoImages": "No images to add.",

"editGameName": "Game Name",
"editGameDescription": "Game Description"
},
Expand Down Expand Up @@ -407,23 +398,19 @@
"scheduled": {
"cleanupInvitationsName": "Clean up invitations",
"cleanupInvitationsDescription": "Cleans up expired invitations from the database to save space.",

"cleanupObjectsName": "Clean up objects",
"cleanupObjectsDescription": "Detects and deletes unreferenced and unused objects to save space.",

"cleanupSessionsName": "Clean up sessions.",
"cleanupSessionsDescription": "Cleans up expired sessions to save space and ensure security.",

"checkUpdateName": "Check update.",
"checkUpdateDescription": "Check if Drop has an update."
},

"runningTasksTitle": "Running tasks",
"noTasksRunning": "No tasks currently running",
"completedTasksTitle": "Completed tasks",
"dailyScheduledTitle": "Daily scheduled tasks",
"weeklyScheduledTitle": "Weekly scheduled tasks",
"viewTask": "View {arrow}",

"back": "{arrow} Back to Tasks"
}
},
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/locales/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/locales/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/locales/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/locales/zh_tw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading