file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
postcss.config.js | JavaScript | module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
| zenorocha/vercel-resend-integration | 3 | TypeScript | zenorocha | Zeno Rocha | resend | |
tailwind.config.js | JavaScript | import type { Config } from 'tailwindcss'
const config: Config = {
content: [
'./app/**/*.{js,ts,jsx,tsx,mdx}', // Note the addition of the `app` directory.
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
// Or if using `src` directory:
'./src/**/*.{js,ts,jsx,tsx,m... | zenorocha/vercel-resend-integration | 3 | TypeScript | zenorocha | Zeno Rocha | resend | |
app.vue | Vue | <script setup lang="ts">
import { createFocusTrap } from "focus-trap"
useHead({
charset: "utf-8",
titleTemplate: (title) => `${title} | KeyPress`,
link: [{ rel: "icon", href: "/logo.svg" }],
})
onMounted(() => {
const trap = createFocusTrap("body", { escapeDeactivates: false })
trap.activate()
})
</script>
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
app/router.options.ts | TypeScript | import type { RouterOptions } from "@nuxt/schema"
// https://router.vuejs.org/api/interfaces/routeroptions.html
export default <RouterOptions>{
routes: (_routes) => {
const { ssrContext } = useNuxtApp()
const subdomain = useSubdomain()
if (ssrContext?.event.context.subdomain) subdomain.value = ssrContext... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
assets/main.css | CSS | /* for easy focus tracking */
button:not(:where(.not-default, [data-tippy-root])),
a:not(:where(.not-default, [data-tippy-root])) {
outline: 2px solid transparent;
outline-offset: 15px;
transition: 0.3s all ease !important;
}
button:not(:where(.not-default)):focus,
a:not(:where(.not-default)):focus {
outline-of... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Button.vue | Vue | <script setup lang="ts">
defineProps({
loading: Boolean,
})
</script>
<template>
<button :data-loading="loading" :disabled="loading" class="btn-loader" v-bind="$attrs">
<slot></slot>
</button>
</template>
<style>
.btn-loader[data-loading="true"]::before,
[data-loading] [data-type="submit"] .formkit-input::b... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Command.vue | Vue | <script lang="ts" setup>
import { useFuse } from "@vueuse/integrations/useFuse"
const router = useRouter()
const user = useSupabaseUser()
const subdomain = useSubdomain()
const url = useUrl()
const keys = useMagicKeys()
const CmdK = keys["Meta+K"]
const Escape = keys["Escape"]
const isVisible = useState("command-visi... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Drawer.vue | Vue | <script setup lang="ts">
import { useFocusTrap } from "@vueuse/integrations/useFocusTrap"
const props = defineProps({ open: Boolean, confirmAction: Function })
const emits = defineEmits(["update:open"])
const el = ref()
onClickOutside(el, () => {
emits("update:open", !props.open)
})
const { activate, deactivate } = ... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Drawer/EditPost.vue | Vue | <script setup lang="ts">
import { PropType } from "vue"
const props = defineProps({
show: Boolean,
settings: Object as PropType<{
image: string
active: boolean
tags: string[]
}>,
})
const emits = defineEmits(["update:show"])
const { settings } = toRefs(props)
watch(
() => props.show,
() => {
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Footer.vue | Vue | <script setup lang="ts">
const url = useUrl()
</script>
<template>
<div class="max-w-screen-lg mx-auto">
<footer class="mt-12 py-6 border-t-2 border-light-700 flex flex-col sm:flex-row justify-between">
<div>
<NuxtLink class="flex items-center font-bold text-xl text-dark-300" to="/"
><Nux... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Loader.vue | Vue | <template>
<div class="my-20 flex flex-col justify-center w-full items-center">
<Logo class="w-12 h-12 animate-spin animate-duration-1500 animate-ease-in-out"></Logo>
<div class="mt-12 font-medium text-gray-400 flex">
<p class="mr-2">Tips:</p>
<p>⌘ + K to search for commands</p>
</div>
</div... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Logo.vue | Vue | <script setup lang="ts"></script>
<template>
<svg viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M0 50C0 8.825 8.825 0 50 0C91.175 0 100 8.825 100 50C100 91.175 91.175 100 50 100C8.825 100 0 91.175 0 50Z"
fill="#2D2D2D"
/>
<path
d="M29.4375 30.4688H46.25V... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Modal.vue | Vue | <script setup lang="ts">
import { useFocusTrap } from "@vueuse/integrations/useFocusTrap"
const props = defineProps({ open: Boolean, confirmAction: Function, innerClass: String })
const emits = defineEmits(["update:open"])
const el = ref()
onClickOutside(el, () => {
emits("update:open", !props.open)
})
const { activ... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Modal/Login.vue | Vue | <script setup lang="ts">
const client = useSupabaseClient()
defineProps({
show: Boolean,
})
const emits = defineEmits(["update:show"])
const signIn = async () => {
const { user } = await client.auth.signIn({ provider: "github" })
}
</script>
<template>
<Modal :open="show" @update:open="emits('update:show', $ev... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Post/Card.vue | Vue | <script setup lang="ts">
import { stripHtml } from "string-strip-html";
import { format } from "date-fns";
import { PropType } from "vue";
import { Posts } from "~~/utils/types";
import { constructUrl } from "~~/utils/functions";
const props = defineProps({
subdomain: Boolean,
post: Object as PropType<Posts>,
});
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/TagsInput.vue | Vue | <script setup lang="ts">
import type { Tags } from "~~/utils/types"
import { PropType } from "vue"
import Multiselect from "@vueform/multiselect"
const props = defineProps({
modelValue: { type: Object as PropType<string[]>, default: [] },
id: String,
})
const emits = defineEmits(["update:modelValue"])
const clien... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Tiptap.vue | Vue | <script lang="ts" setup>
import { useEditor, EditorContent } from "@tiptap/vue-3"
import StarterKit from "@tiptap/starter-kit"
import Underline from "@tiptap/extension-underline"
import Image from "@tiptap/extension-image"
import Focus from "@tiptap/extension-focus"
import Commands from "~~/utils/tiptap/commands"
impo... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Tiptap/Bubble.vue | Vue | <script setup lang="ts">
// bubble menu: https://tiptap.dev/api/extensions/bubble-menu
import { BubbleMenu } from "@tiptap/vue-3"
import { PropType } from "vue"
import type { Editor } from "@tiptap/core"
import type { NodeSelection } from "prosemirror-state"
import { TextSelection } from "prosemirror-state"
const prop... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Tiptap/CommandList.vue | Vue | <template>
<div class="bg-white px-2 py-4 rounded-xl shadow-xl flex flex-col w-72">
<template v-if="items.length">
<button
class="p-2 flex flex-col text-sm text-left rounded-lg bg-transparent transition"
:class="{ '!bg-light-300': index === selectedIndex }"
v-for="(item, index) in it... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Tiptap/ModalIframe.vue | Vue | <script setup lang="ts">
import type { Editor } from "@tiptap/core"
import { PropType } from "vue"
const props = defineProps({
show: Boolean,
editor: Object as PropType<Editor>,
})
const open = ref(props.show)
const url = ref("")
const save = () => {
if (!url.value?.match(/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Tiptap/ModalImage.vue | Vue | <script setup lang="ts">
import type { Editor } from "@tiptap/core"
import { PropType } from "vue"
const props = defineProps({
show: Boolean,
editor: Object as PropType<Editor>,
})
const isVisible = ref(props.show)
const alt = ref("")
const image = ref("")
const isLoading = ref(false)
const save = async () => {
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/TiptapHeading.vue | Vue | <script lang="ts" setup>
import { useEditor, EditorContent, Extension } from "@tiptap/vue-3"
import Document from "@tiptap/extension-document"
import Text from "@tiptap/extension-text"
import Heading from "@tiptap/extension-heading"
import Placeholder from "@tiptap/extension-placeholder"
import Focus from "@tiptap/exte... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Toggle.vue | Vue | <script setup lang="ts">
const props = defineProps({
modelValue: Boolean,
id: String,
})
const emits = defineEmits(["update:modelValue"])
const emitData = (ev: InputEvent) => {
//@ts-ignore
emits("update:modelValue", ev.target.checked)
}
</script>
<template>
<label :for="id" class="inline-flex relative item... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
components/Upload.vue | Vue | <script setup lang="ts">
const props = defineProps({
modelValue: String,
})
const emits = defineEmits(["update:modelValue"])
const client = useSupabaseClient()
const user = useSupabaseUser()
const { files, open: openFileDialog, reset } = useFileDialog({ accept: "image/*" })
const { base64 } = useBase64(computed(() ... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
composables/dashboard.ts | TypeScript | import type { Profiles } from "~~/utils/types"
import type { Ref } from "vue"
export const useProfile = () => useState<Profiles>("profile", () => null)
export const useProfileSave = (payload: Ref<Partial<Profiles>>) => {
const user = useSupabaseUser()
const client = useSupabaseClient()
const isSaving = ref(fal... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
composables/head.ts | TypeScript | import { ComputedRef } from "vue"
export const useCustomHead = (
title?: string | ComputedRef<string>,
description?: string | ComputedRef<string>,
image?: string | ComputedRef<string>
) => {
useHead({
title,
meta: [
{
name: "description",
content:
description ?? "An open... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
composables/subdomain.ts | TypeScript | import type { Profiles } from "~~/utils/types"
export const useSubdomain = () => useState<string>("subdomain", () => null)
export const useSubdomainProfile = () => useState<Profiles>("subdomain-profile", () => null)
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
composables/url.ts | TypeScript | export const useUrl = () => (process.dev ? "http://localhost:3000" : "https://keypress.blog")
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
layouts/default.vue | Vue | <script lang="ts" setup>
const user = useSupabaseUser()
</script>
<template>
<div class="p-4 bg-light-300 min-h-screen w-full flex flex-col">
<div class="max-w-screen-lg mx-auto w-full">
<nav class="flex justify-between items-center">
<NuxtLink to="/">
<Logo class="w-12 h-12"></Logo>
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
layouts/user.vue | Vue | <script lang="ts" setup>
const user = useSupabaseUser();
const url = useUrl();
</script>
<template>
<div class="p-4 bg-light-300 min-h-screen w-full flex flex-col">
<div class="max-w-screen-lg mx-auto w-full">
<nav class="flex justify-between items-center">
<NuxtLink to="/">
<Logo class="... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
middleware/auth.ts | TypeScript | export default defineNuxtRouteMiddleware((to, from) => {
const user = useSupabaseUser()
if (!user.value && to.path !== "/write") {
return navigateTo("/login")
}
})
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
modules/og.ts | TypeScript | import { defineNuxtModule } from "@nuxt/kit"
import { copyFile, cp } from "fs/promises"
export default defineNuxtModule({
setup(options, nuxt) {
nuxt.hook("close", async () => {
await cp("public/fonts", ".vercel/output/functions/__nitro.func/public/fonts", { recursive: true })
})
},
})
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
nuxt.config.ts | TypeScript | import transformerDirective from "@unocss/transformer-directives"
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: ["@unocss/nuxt", "@nuxtjs/supabase", "@vueuse/nuxt", "@nuxt/image-edge", "~~/modules/og"],
css: ["@unocss/reset/tailwind.css", "~~/assets/main.css"],
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/dashboard.vue | Vue | <script setup lang="ts">
import { Profiles } from "~~/utils/types"
const user = useSupabaseUser()
const client = useSupabaseClient()
const profile = useProfile()
const { pending } = useAsyncData(
"profile",
async () => {
const { data } = await client
.from<Profiles>("profiles")
.select("*, domains... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/dashboard/domain.vue | Vue | <script setup lang="ts">
const profile = useProfile()
const payload = ref({ subdomain: profile.value.subdomain })
const isSaving = ref(false)
const { save } = useProfileSave(payload)
const saveDomain = async () => {
// validate here
try {
isSaving.value = true
// add domain and check first
const data ... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/dashboard/index.vue | Vue | <script setup lang="ts"></script>
<template>
<div></div>
</template>
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/dashboard/posts.vue | Vue | <script setup lang="ts">
import { format } from "date-fns"
const profile = useProfile()
</script>
<template>
<div class="w-full">
<ul>
<li v-for="post in profile.posts" class="my-4">
<NuxtLink :to="`/edit/${post.id}`" class="block">
<div class="p-4 rounded-2xl bg-white shadow-none focus:... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/dashboard/profile.vue | Vue | <script setup lang="ts">
const profile = useProfile()
const payload = ref({ name: profile.value.name })
const { save, isSaving } = useProfileSave(payload)
const saveProfile = async () => {
// validate
save()
}
</script>
<template>
<div class="w-full">
<div class="flex w-full justify-end">
<Button :lo... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/edit/[id].vue | Vue | <script lang="ts" setup>
import { stripHtml } from "string-strip-html"
import slugify from "slugify"
import { Posts } from "~~/utils/types"
const user = useSupabaseUser()
const client = useSupabaseClient()
const { params } = useRoute()
const postId = ref(params.id)
const title = postId.value ? ref("") : useLocalStor... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/index.vue | Vue | <script setup lang="ts">
import { Posts } from "~~/utils/types";
useCustomHead("Experience keyboard-first blogging platform");
const client = useSupabaseClient();
const { data, pending } = useAsyncData(
"posts",
async () => {
const { data } = await client
.from<Posts>("posts")
.select("*, profiles... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/login.vue | Vue | <script lang="ts" setup>
const client = useSupabaseClient()
const signIn = async () => {
const { user } = await client.auth.signIn({ provider: "github" })
}
useCustomHead("Login")
</script>
<template>
<div class="flex flex-col mx-auto max-w-48 mt-20">
<h1 class="text-4xl font-bold text-center">Login</h1>
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/posts.vue | Vue | <script setup lang="ts">
import type { Posts, Tags } from "~~/utils/types";
const client = useSupabaseClient();
const { data, pending } = useAsyncData("posts", async () => {
const { data } = await client
.from<Posts>("posts")
.select("*, profiles(avatar_url, name,username, domains (url, active))")
.eq("... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/user/[siteId].vue | Vue | <script setup lang="ts">
import { Profiles } from "~~/utils/types"
const client = useSupabaseClient()
const subdomain = useSubdomain()
const profile = useSubdomainProfile()
// this should fetch user's profiles and settings (if any)
useAsyncData("profile", async () => {
const { data, error } = await client
.from... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/user/[siteId]/[slug].vue | Vue | <script setup lang="ts">
import { format } from "date-fns"
import { Posts } from "~~/utils/types"
import { stripHtml } from "string-strip-html"
import { constructUrl } from "~~/utils/functions"
const client = useSupabaseClient()
const { params } = useRoute()
const url = useUrl()
const { data, pending } = useAsyncData... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/user/[siteId]/home.vue | Vue | <script setup lang="ts">
const { params } = useRoute()
</script>
<template>
<div>Home for user {{ params.slug }}</div>
</template>
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
pages/user/[siteId]/index.vue | Vue | <script setup lang="ts">
import type { Posts } from "~~/utils/types";
const client = useSupabaseClient();
const profile = useSubdomainProfile();
const { data, pending } = useAsyncData("posts", async () => {
const { data, error } = await client
.from<Posts>("posts")
.select("*, profiles!inner (username)")
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
plugins/umami.client.ts | TypeScript | export default defineNuxtPlugin(() => {
const cfg = useRuntimeConfig()
const moduleOptions = {
scriptUrl: "https://umami-zernonia.vercel.app/script.js",
websiteId: cfg.public.UMAMI_WEBSITE_ID,
}
const options = { ...moduleOptions }
if (moduleOptions.websiteId) {
loadScript(options)
}
})
funct... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/api/_supabase/session.post.ts | TypeScript | import { setCookie, defineEventHandler } from "h3"
export default defineEventHandler(async (event) => {
const body = await useBody(event)
const config = useRuntimeConfig().public
const cookieOptions = config.supabase.cookies
const { event: signEvent, session } = body
if (!event) {
throw new Error("Aut... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/api/add-domain.post.ts | TypeScript | // ref: https://github.com/vercel/platforms/blob/main/lib/api/domain.ts
import { serverSupabaseClient, serverSupabaseUser } from "#supabase/server"
import type { Domains } from "~~/utils/types"
export default defineEventHandler(async (event) => {
try {
const { domain, user_id } = await useBody(event)
const u... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/api/check-domain.post.ts | TypeScript | //ref: https://github.com/vercel/platforms/blob/main/pages/api/domain/check.ts
import { serverSupabaseClient } from "#supabase/server"
import type { Domains } from "~~/utils/types"
export default defineEventHandler(async (event) => {
try {
const { domain, subdomain = false } = await useBody(event)
const clie... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/api/delete-domain.post.ts | TypeScript | // ref: https://github.com/vercel/platforms/blob/main/lib/api/domain.ts
export default defineEventHandler(async (event) => {
try {
const { domain, user_id } = await useBody(event)
if (Array.isArray(domain) || Array.isArray(user_id))
createError({ statusCode: 400, statusMessage: "Bad request. Query par... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/api/request-delegation.ts | TypeScript | export default defineEventHandler((event) => {
return 'Hello add-domain'
})
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/api/user-validation.post.ts | TypeScript | export default defineEventHandler(async (event) => {
const { access_token } = await useBody(event)
const hostname = event.req.headers.host
// validate this token
// setCookie(event, "sb-access-token", access_token, {
// maxAge: 60 * 60 * 8 ?? 0,
// path: "/",
// sameSite: "lax",
// })
return "a... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/middleware/login.ts | TypeScript | import { sendRedirect, defineEventHandler } from "h3"
export default defineEventHandler(async (event) => {
const { req, res } = event
const referrer = req.headers.referer
const cookie = useCookies(event)
const accessToken = cookie["sb-access-token"]
const refreshToken = cookie["sb-refresh-token"]
// consol... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/middleware/subdomain.ts | TypeScript | export default defineEventHandler(({ req, res, context }) => {
const hostname = req.headers.host || "keypress.blog"
const mainDomain = ["localhost:3000", "keypress.blog"]
if (!mainDomain.includes(hostname)) {
const currentHost =
process.env.NODE_ENV === "production" && process.env.VERCEL === "1"
... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
server/routes/og/[slug].ts | TypeScript | import { readFileSync } from "fs"
import { join, resolve } from "path"
import { serverSupabaseClient } from "#supabase/server"
import { useUrl } from "~~/composables/url"
import { Resvg, ResvgRenderOptions } from "@resvg/resvg-js"
import type { Posts } from "~~/utils/types"
import satori from "satori"
export default d... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/functions.ts | TypeScript | import { Posts } from "./types"
export const constructUrl = (post: Posts, subdomain = false) => {
if (subdomain) return `/${post.slug}`
if (process.dev) return `http://${post?.profiles?.username}.localhost:3000/${post.slug}`
else {
if (post?.profiles?.domains?.active) return `https://${post.profiles.domains.... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/code.ts | TypeScript | import { Extension } from "@tiptap/core"
import Code from "@tiptap/extension-code"
import CodeBlock from "@tiptap/extension-code-block"
import CodeBlockLowLight from "@tiptap/extension-code-block-lowlight"
import { lowlight } from "lowlight"
import css from "highlight.js/lib/languages/css"
import js from "highlight.js... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/commands.ts | TypeScript | import { Extension } from "@tiptap/core"
import Suggestion from "@tiptap/suggestion"
// ref: https://tiptap.dev/experiments/commands
export default Extension.create({
name: "commands",
addOptions() {
return {
suggestion: {
char: "/",
command: ({ editor, range, props }) => {
pro... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/hardbreak.ts | TypeScript | import { Extension } from "@tiptap/core"
export default Extension.create({
addKeyboardShortcuts() {
// copied from tiptap
const defaultHandler = () =>
this.editor.commands.first(({ commands }) => [
() => commands.newlineInCode(),
() => commands.createParagraphNear(),
() => comma... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/iframe.ts | TypeScript | // ref: https://github.com/ueberdosis/tiptap/blob/9afadeb7fe368f95064f84424d6a3dd6cd85b43d/demos/src/Experiments/Embeds/Vue/iframe.ts
import { mergeAttributes, Node } from "@tiptap/core"
export interface IframeOptions {
allowFullscreen: boolean
HTMLAttributes: {
[key: string]: any
}
}
declare module "@tipta... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/link.ts | TypeScript | // 1. Import the extension
import Link from "@tiptap/extension-link"
// 2. Overwrite the keyboard shortcuts
export default Link.extend({
exitable: true,
})
| zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/move.ts | TypeScript | import { CommandProps, Editor, Extension } from "@tiptap/core"
import { findParentNodeOfType } from "prosemirror-utils"
import { EditorState, NodeSelection, Selection, TextSelection } from "prosemirror-state"
import { Fragment, NodeType, Slice } from "prosemirror-model"
import { ReplaceStep } from "prosemirror-transfor... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/placeholder.ts | TypeScript | // 1. Import the extension
import Placeholder from "@tiptap/extension-placeholder"
import { NodeSelection, TextSelection } from "prosemirror-state"
// 2. Overwrite the keyboard shortcuts
export default Placeholder.extend({
addOptions() {
return {
...this.parent?.(),
placeholder: ({ node, editor }) =>... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/suggestion.ts | TypeScript | import type { Editor, Range } from "@tiptap/core"
import { VueRenderer } from "@tiptap/vue-3"
import tippy from "tippy.js"
import CommandsList from "~~/components/Tiptap/CommandList.vue"
interface Command {
editor: Editor
range: Range
}
export default {
items: ({ query }) => {
return [
{
title... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/tiptap/upload.ts | TypeScript | import { Extension } from "@tiptap/core"
import ModalImage from "~~/components/Tiptap/ModalImage.vue"
import ModalIframe from "~~/components/Tiptap/ModalIframe.vue"
import { createApp } from "vue"
declare module "@tiptap/core" {
interface Commands<ReturnType> {
upload: {
openModal: (type: "image" | "iframe... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
utils/types.ts | TypeScript | // generated from https://supabase-schema.vercel.app/
export interface Profiles {
id: string /* primary key */;
username?: string;
avatar_url?: string;
name?: string;
created_at?: string;
subdomain?: string;
domains: Domains;
posts: Posts[];
}
export interface Domains {
user_id?: string /* foreign ke... | zernonia/keypress | 266 | KeyPress - an open-source blogging platform + free custom domains. | Vue | zernonia | zernonia | Troop Travel |
.eslintrc.cjs | JavaScript | module.exports = {
extends: '@antfu',
rules: {
'vue/no-unused-vars': 'warn',
'vue/valid-v-for': 'warn',
},
}
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/.keys.ts | TypeScript | import type { InjectionKey, Ref } from "vue";
import type { Provider } from "./.types";
export const rootKey = Symbol() as InjectionKey<{
hideProviderLabel?: boolean;
providers?: Provider[];
}>;
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/.types.ts | TypeScript | export type Provider =
| "facebook"
| "twitter"
| "google"
| "discord"
| "github"
| "gitlab"
| "apple"
| "slack"
| "azure"
| "bitbucket"
| "tiktok"
| "linkedin";
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/Form.vue | Vue | <script setup lang="ts">
const emits = defineEmits<{
(e: 'submit', payload: { [key: string]: any }): void
}>()
function handleSignIn(ev: Event) {
ev.preventDefault()
const form = ev.target as HTMLFormElement
if (!form)
return
const formData = new FormData(form)
emits(
'submit',
Object.fromEntr... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/Form/Button.vue | Vue | <script setup lang="ts">
defineProps<{ label?: string }>()
</script>
<template>
<input type="submit" style="cursor: pointer" :value="label ?? 'Sign In'">
</template>
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/Form/InputText.vue | Vue | <script setup lang="ts">
import type { InputHTMLAttributes } from 'vue'
interface Props extends /* @vue-ignore */ InputHTMLAttributes {
label: string
name: string
type: string
}
defineProps<Props>()
</script>
<script lang="ts">
export default {
inheritAttrs: false,
}
</script>
<template>
<div>
<label ... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/Header.vue | Vue | <script setup lang="ts"></script>
<template>
<div>
<slot name="logo" />
<slot>
<h2>Create your account</h2>
<p>to continue to Acme</p>
</slot>
</div>
</template>
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/SocialProvider.vue | Vue | <script setup lang="ts">
import type { Component } from 'vue'
import { rootKey } from './.keys'
import type { Provider } from './.types'
const props = defineProps<{
provider: Provider
is?: Component
}>()
const emits = defineEmits<{
(e: 'select', payload: Provider): void
}>()
const rootProps = inject(rootKey)
... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/SocialProviders.vue | Vue | <script setup lang="ts">
import { rootKey } from './.keys'
import type { Provider } from './.types'
const emits = defineEmits<{
(e: 'select', payload: Provider): void
}>()
const rootProps = inject(rootKey)
</script>
<script lang="ts">
export default {
inheritAttrs: false,
}
</script>
<template>
<LegoAuthSocial... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Auth/index.vue | Vue | <script setup lang="ts">
import { rootKey } from './.keys'
import type { Provider } from './.types'
const props = defineProps<{
hideProviderLabel?: boolean
providers?: Provider[]
}>()
provide(rootKey, props)
</script>
<template>
<div>
<slot>
<LegoAuthHeader />
<LegoAuthSocialProvider provider=... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/CountDown/index.vue | Vue | <script setup lang="ts">
const props = defineProps<{
date: Date
enableDays?: boolean
}>()
const timestamp = useTimestamp()
const dateInMilliseconds = computed(() => props.date?.getTime())
const differenceInSeconds = computed(() => (dateInMilliseconds.value - timestamp.value) / 1000) // in seconds
const days = co... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/GithubStar/index.vue | Vue | <script lang="ts" setup>
import { withBase, withoutBase } from 'ufo'
import { useFetch } from '#imports'
const props = defineProps<{
repo: string
raw?: boolean
to?: string
}>()
const repo = computed(() => {
// support users providing full github url
return withoutBase(props.repo, 'https://github.com/')
})
c... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/MarqueeBanner/.composables.ts | TypeScript | import { useSlots, inject, ref, type Ref, computed } from "vue"
import { rootKey } from "./.keys"
export const useMarqueeBanner = (el: Ref<HTMLElement[] | undefined>) => {
const slots = useSlots()
const rootInject = inject(rootKey, {
width: ref(0),
})
const componentsWidth = computed(() => el.value?.map(... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/MarqueeBanner/.keys.ts | TypeScript | import type { InjectionKey, Ref } from "vue";
export const rootKey = Symbol() as InjectionKey<{
width: Ref<number>,
speed?: number,
hoveredSpeed?: number
shadowCount?: number
}>;
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/MarqueeBanner/Left.vue | Vue | <script setup lang="ts">
import { ref } from 'vue'
import { rootKey } from './.keys'
import { useMarqueeBanner } from './.composables'
const el = ref<HTMLElement[]>()
const offset = ref(0)
const intervalId = ref()
const rootInject = inject(rootKey, {
speed: 1,
hoveredSpeed: 0.5,
})
const { componentsWidth, baseE... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/MarqueeBanner/Right.vue | Vue | <script setup lang="ts">
import { ref } from 'vue'
import { rootKey } from './.keys'
import { useMarqueeBanner } from './.composables'
const rootInject = inject(rootKey, {
speed: 1,
hoveredSpeed: 0.5,
})
const el = ref<HTMLElement[]>()
const offset = ref(0)
const intervalId = ref()
const { componentsWidth, baseE... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/MarqueeBanner/index.vue | Vue | <script setup lang="ts">
import { provide, ref } from 'vue'
import { rootKey } from './.keys'
const props = withDefaults(defineProps<{
speed?: number
hoveredSpeed?: number
shadowCount?: number
}>(), {
speed: 1,
hoveredSpeed: 0.5,
shadowCount: 5,
})
const el = ref<HTMLDivElement>()
const { width } = useEle... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/PageProgress/index.vue | Vue | <script setup lang="ts">
import type { MaybeElementRef } from '@vueuse/core'
const props = defineProps<{
target: MaybeElementRef
}>()
const { target } = toRefs(props)
const progress = ref(0)
const offsetTop = ref(0)
onMounted(() => {
window.addEventListener('scroll', () => {
const { documentElement, body } =... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Preview/.keys.ts | TypeScript | import type { InjectionKey, Ref } from "vue";
export const rootKey = Symbol() as InjectionKey<{
isPreviewActive: Ref<boolean>,
}>;
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Preview/Dialog.vue | Vue | <script setup lang="ts">
import { rootKey } from './.keys'
defineProps<{
name?: string
}>()
const { isPreviewActive } = inject(rootKey)
</script>
<script lang="ts">
export default {
inheritAttrs: false,
}
</script>
<template>
<Teleport to="body">
<div v-if="isPreviewActive" v-bind="$attrs" role="dialog" s... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Preview/index.vue | Vue | <script setup lang="ts">
import { ref } from 'vue'
import type { CSSProperties } from 'nuxt/dist/app/compat/capi'
import { rootKey } from './.keys'
const props = withDefaults(defineProps<{
duration?: number
maxWidth?: number
}>(),
{
duration: 500,
maxWidth: 1000,
})
const el = ref<HTMLElement>()
const isPrevi... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/SocialShare/.keys.ts | TypeScript | import type { InjectionKey, Ref } from "vue";
export default Symbol() as InjectionKey<Ref<string>>;
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/SocialShare/Facebook.vue | Vue | <script setup lang="ts">
import key from './.keys'
const path = inject(key)
const url = computed(
() =>
`https://www.facebook.com/sharer/sharer.php?u=${encodeURI(
path?.value ?? '',
)}`,
)
</script>
<template>
<NuxtLink :to="url" target="_blank">
<slot>
<Icon name="uil:facebook" />
</... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/SocialShare/Link.vue | Vue | <script setup lang="ts">
import key from './.keys'
const path = inject(key)
const { copy } = useClipboard({ source: path })
</script>
<template>
<button @click="copy()">
<slot>
<Icon name="uil:share-alt" />
</slot>
</button>
</template>
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/SocialShare/LinkedIn.vue | Vue | <script setup lang="ts">
import key from './.keys'
const props = defineProps<{ text?: string }>()
const path = inject(key)
const url = computed(
() =>
`https://www.linkedin.com/shareArticle/?mini=true&url=${encodeURI(
path?.value ?? '',
)}&title=${encodeURI(props.text ?? '')}`,
)
</script>
<template... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/SocialShare/Reddit.vue | Vue | <script setup lang="ts">
import key from './.keys'
const props = defineProps<{ text?: string }>()
const path = inject(key)
const url = computed(
() =>
`http://www.reddit.com/submit?url=${encodeURI(
path?.value ?? '',
)}&title=${encodeURI(props.text ?? '')}`,
)
</script>
<template>
<NuxtLink :to="u... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/SocialShare/Twitter.vue | Vue | <script setup lang="ts">
import key from './.keys'
const props = defineProps<{ text?: string }>()
const path = inject(key)
const url = computed(
() =>
`https://twitter.com/intent/tweet?url=${encodeURI(
path?.value ?? '',
)}&text=${encodeURI(props.text ?? '')}`,
)
</script>
<template>
<NuxtLink :to=... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/SocialShare/index.vue | Vue | <script setup lang="ts">
import key from './.keys'
const props = defineProps<{ url?: string }>()
const url = ref(props.url)
onMounted(() => {
if (!url.value)
url.value = window.location.origin + window.location.pathname
})
provide(key, url)
</script>
<template>
<div>
<slot>
<LegoSocialShareLink />... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Toc/Links.vue | Vue | <script setup lang="ts">
import type { TocLink } from '@nuxt/content/dist/runtime/types'
defineProps<{
links: TocLink[]
}>()
const router = useRouter()
function scrollToHeading(id: string) {
router.push(`#${id}`)
}
</script>
<template>
<ul>
<li v-for="link in links" :key="link.text">
<a :href="`#${l... | zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Toc/index.vue | Vue | <script setup lang="ts"></script>
<template>
<div>
<div>
<slot name="title">
Table of Contents
</slot>
</div>
<slot>add <code>LegoTocLinks</code> </slot>
</div>
</template>
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Tweet/.keys.ts | TypeScript | import type { InjectionKey, Ref } from "vue";
import type { Tweet } from "../../../types";
export default Symbol() as InjectionKey<Ref<Tweet>>;
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Tweet/Action.vue | Vue | <script setup lang="ts"></script>
<template>
<div>
<slot>
<LegoTweetActionLove />
<LegoTweetActionReply />
<LegoTweetActionCopy />
</slot>
</div>
</template>
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
layer/components/Lego/Tweet/Action/.keys.ts | TypeScript | import type { InjectionKey, Ref } from "vue";
export const copiedKey = Symbol() as InjectionKey<Ref<Boolean>>;
| zernonia/nuxt-lego | 234 | NuxtLego is an open source UI component layer for building your Nuxt content quick & beautiful. | Vue | zernonia | zernonia | Troop Travel |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.