(fix) build fails

This commit is contained in:
kakkokari-gtyih 2023-09-23 18:17:13 +09:00
parent a9c2e34c8a
commit 9e4c2cfa47
13 changed files with 643 additions and 589 deletions

View File

@ -1,8 +1,10 @@
<script setup lang="ts">
import ExtIco from 'bi/box-arrow-up-right.svg';
import { $URL, isRelative, joinURL, cleanDoubleSlashes } from 'ufo';
const runtimeConfig = useRuntimeConfig();
const rootDomain = new URL(runtimeConfig.public.baseUrl);
const rootDomain = new $URL(runtimeConfig.public.baseUrl);
const { resolve } = useRouter();
const localePath = useLocalePath();
const props = defineProps({
@ -17,31 +19,29 @@ const props = defineProps({
},
})
let realHref = props.href;
let realTarget = props.target;
const realHref = ref(props.href);
const realTarget = ref(props.target);
try {
const url = new URL(props.href);
if (!url.hostname || rootDomain.hostname === url.hostname) {
realHref = localePath(realHref);
const url = new $URL(realHref.value);
if (url.host === '' || rootDomain.host === url.host) {
//
const route = resolve(realHref.value);
if (route.name && !route.name.toString().includes('___')) {
//
realHref.value = localePath(url.fullpath);
}
if (rootDomain.hostname !== url.hostname) {
realTarget = '_blank';
}
} catch(_) {
if(realHref !== '') {
if (!realHref.startsWith('.') || !realHref.startsWith('http')) {
realHref = localePath(realHref);
} else {
realHref = '../' + realHref;
}
// trailing slash
if (isRelative(realHref.value)) {
realHref.value = joinURL('../', realHref.value);
}
} else if (rootDomain.host !== url.host) {
realTarget.value = '_blank';
}
</script>
<template>
<GNuxtLink :href="realHref" :target="realTarget">
<GNuxtLink :to="realHref" :target="realTarget">
<slot></slot><ExtIco v-if="realTarget === '_blank'" class="text-xs mx-1" />
</GNuxtLink>
</template>

View File

@ -1,6 +0,0 @@
// 末尾スラッシュの統一のためにラッパーNuxtLinkを実装
export default defineNuxtLink({
componentName: "NuxtLink",
trailingSlash: 'append',
});

29
components/g/NuxtLink.vue Normal file
View File

@ -0,0 +1,29 @@
<template>
<RealNuxtLink v-bind="props">
<slot></slot>
</RealNuxtLink>
</template>
<script setup lang="ts">
import { cleanDoubleSlashes } from 'ufo';
import { NuxtLinkProps } from 'nuxt/app';
const rawProps = defineProps();
const props = ref<NuxtLinkProps>(Object.assign({}, rawProps));
if (props.value.to && typeof props.value.to === 'string') {
props.value.to = cleanDoubleSlashes(props.value.to);
}
if (props.value.href && typeof props.value.href === 'string') {
props.value.href = cleanDoubleSlashes(props.value.href);
}
const RealNuxtLink = defineNuxtLink({
trailingSlash: "append",
});
</script>
<style scoped>
</style>

View File

@ -54,7 +54,7 @@ UUIDを生成する。以後これを**セッションID**と呼びます。
#### Step 2
アプリケーション認証フォームをユーザーのブラウザで表示させる。認証フォームは、以下の形式のURLで開くことができます:
```:no-line-numbers
```
https://{host}/miauth/{session}
```
@ -72,7 +72,7 @@ https://{host}/miauth/{session}
| `permission` | アプリケーションが要求する権限。<br>要求する権限を`,`で区切って列挙します。権限の一覧は[こちら](./permission.md)で確認できます。 |
:::tip 例
```:no-line-numbers
```
https://misskey.io/miauth/c1f6d42b-468b-4fd2-8274-e58abdedef6f?name=MyApp&callback=https%3A%2F%2Fmyapp.example.com%2Fcallback&permission=write:notes,write:following,read:drive
```
:::
@ -80,7 +80,7 @@ https://misskey.io/miauth/c1f6d42b-468b-4fd2-8274-e58abdedef6f?name=MyApp&callba
#### Step 3
ユーザーがアプリケーションアクセスを許可した後、次の形式のURLにPOSTリクエストすると、レスポンスとしてアクセストークンを含むJSONが返ります。
```:no-line-numbers
```
https://{host}/api/miauth/{session}/check
```

View File

@ -16,7 +16,7 @@ description: 'ストリーミングAPIを使うと、リアルタイムで様々
以下の形式のURLにwebsocket接続します:
```:no-line-numbers
```
wss://{host}/streaming?i={token}
```

6
error.vue Normal file
View File

@ -0,0 +1,6 @@
<template>
<div class="text-slate-800 dark:text-slate-200 bg-slate-100 dark:bg-gray-900">
<noscript class="block bg-accent-800 text-white text-center py-1.5 px-3 keep-all relative z-[10005]">Please turn on Javascript from your browser's settings.</noscript>
ページが見つかりませんでした
</div>
</template>

View File

@ -129,6 +129,7 @@ _docs:
_blog:
title: "ブログ"
description: "Misskey開発本部から、Misskeyに関する最新情報やTips等をお届けします日本語のみ"
back: "戻る"
_content:
tip: "ヒント"
warning: "注意"

View File

@ -10,7 +10,7 @@
},
"devDependencies": {
"@modyfi/vite-plugin-yaml": "^1.0.4",
"@nuxt/content": "^2.8.2",
"@nuxt/content": "^2.8.0",
"@nuxtjs/color-mode": "^3.3.0",
"@nuxtjs/i18n": "8.0.0-beta.13",
"@types/js-yaml": "^4.0.5",
@ -25,7 +25,7 @@
"meshline": "^3.1.6",
"mfm-js": "^0.23.3",
"misskey-js": "^0.0.16",
"nuxt": "^3.7.1",
"nuxt": "^3.7.3",
"postcss": "^8.4.29",
"rellax": "^1.12.1",
"sass": "^1.66.1",
@ -34,6 +34,7 @@
"tailwindcss": "^3.3.3",
"three": "^0.154.0",
"tinycolor2": "^1.6.0",
"ufo": "^1.3.0",
"vite-svg-loader": "^4.0.0"
},
"packageManager": "pnpm@8.6.0",

View File

@ -1,6 +1,9 @@
<template>
<div>
<div class="min-h-[150px] flex flex-col justify-center">
<div class="mx-auto container max-w-screen-md relative py-5">
<GNuxtLink :to="localePath('/blog/', 'ja')" class="absolute top-2.5 left-0 p-2.5 opacity-40">
<LeftIco class="mr-2 stroke-1 stroke-current" />
</GNuxtLink>
<p class="text-center mb-4">{{ $t('_blog.title') }}</p>
<h1 class="text-center font-bold text-2xl lg:text-3xl mb-4">{{ data.title }}</h1>
<p class="text-center">{{ $d(new Date(data.date)) }}</p>
@ -9,16 +12,24 @@
<div class="mx-auto container max-w-screen-md markdown-body">
<ContentRenderer :value="data" />
</div>
<div class="text-center mt-6 lg:mt-12">
<GNuxtLink :to="localePath('/blog/', 'ja')" class="text-xl font-bold hover:opacity-70">
<LeftIco class="mr-2" />{{ $t('_blog.back') }}
</GNuxtLink>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import LeftIco from 'bi/arrow-left.svg';
//
defineI18nRoute({
locales: ['ja'],
});
const localePath = useLocalePath();
const route = useRoute();
const { data } = await useAsyncData(`blog-${route.params.slug}`, () => queryContent(`/blog/${route.params.slug}`).findOne())
</script>

View File

@ -17,7 +17,7 @@
</GHero>
<div class="pb-12 lg:mt-12 pt-6 bg-white dark:bg-slate-950">
<div class="container mx-auto max-w-screen-lg px-6 space-y-4 lg:space-y-2">
<GNuxtLink
<NuxtLink
class="block p-4 rounded-lg border border-slate-200 dark:border-accent-900 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
v-for="item in data"
:key="item._path"
@ -25,7 +25,7 @@
>
<h3 class="text-lg font-bold mb-2">{{ item.navTitle || item.title }}</h3>
<p class="text-sm">{{ item.date ? $d(new Date(item.date)) : '' }}</p>
</GNuxtLink>
</NuxtLink>
</div>
</div>
</div>

View File

@ -36,7 +36,7 @@
</template>
<script setup lang="ts">
import { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
const { locale, locales } = useI18n();
const openState = ref<boolean>(false);
@ -57,10 +57,9 @@ const slugs = (route.params.slug as string[]).filter((v) => v !== '');
const { data } = await useAsyncData(`blog-${locale.value}-${slugs.join('-')}`, () => queryContent(`/${locale.value}/docs/${slugs.join('/')}`).findOne());
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(queryContent(`/${locale.value}/docs/${slugs[0]}`)));
/*
if (!data.value) {
throw createError({ statusCode: 404, statusMessage: 'page not found' });
}*/
}
route.meta.title = data.value?.title;
</script>

File diff suppressed because it is too large Load Diff

View File

@ -27,4 +27,5 @@ export default async function genSitemap(nitro: Nitro) {
const data = await streamToPromise(smStream);
writeFileSync(path.join(publicDir, 'sitemap.xml'), data.toString());
console.log("Sitemap was generated");
}