refactor(*): refactor tsconfig paths
looks/feels nicer
This commit is contained in:
parent
9ba432a8e0
commit
3e5af47107
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
import { MenuProps } from "ant-design-vue";
|
import { MenuProps } from "ant-design-vue";
|
||||||
|
|
||||||
const { data, status } = useAuth();
|
const { data, status } = useAuth();
|
||||||
@ -48,47 +48,55 @@
|
|||||||
@click="clickFn"
|
@click="clickFn"
|
||||||
:active-key="cur"
|
:active-key="cur"
|
||||||
>
|
>
|
||||||
<a-menu-item key="home"> Home </a-menu-item>
|
<a-menu-item key="home"> {{ $tm("navbar.home") }} </a-menu-item>
|
||||||
<a-menu-item key="bands"> Bands </a-menu-item>
|
<a-menu-item key="bands"> {{ $tm("navbar.bands") }} </a-menu-item>
|
||||||
<a-menu-item key="authors"> Authors </a-menu-item>
|
<a-menu-item key="authors"> {{ $tm("navbar.authors") }} </a-menu-item>
|
||||||
<a-menu-item key="forum"> Message Board </a-menu-item>
|
<a-menu-item key="forum"> {{ $tm("navbar.forum") }} </a-menu-item>
|
||||||
<a-sub-menu title="My Stuff" v-if="!!data?.user" key="group/my-stuff">
|
<a-sub-menu
|
||||||
<a-menu-item key="account"> Account </a-menu-item>
|
:title="$tm('navbar.profile.myStuff') as any"
|
||||||
<a-menu-item key="edit-profile"> Edit Profile </a-menu-item>
|
v-if="!!data?.user"
|
||||||
<a-menu-item key="profile"> View Profile </a-menu-item>
|
key="group/my-stuff"
|
||||||
<a-menu-item key="stories"> Stories </a-menu-item>
|
>
|
||||||
<a-menu-item key="drafts"> Drafts </a-menu-item>
|
<a-menu-item key="account"> {{ $tm("navbar.account") }} </a-menu-item>
|
||||||
<a-menu-item key="reviews"> Manage Reviews </a-menu-item>
|
<a-menu-item key="edit-profile">
|
||||||
<a-menu-item key="messages"> Private Messages </a-menu-item>
|
{{ $tm("navbar.editProfile") }}
|
||||||
|
</a-menu-item>
|
||||||
|
<a-menu-item key="profile"> {{ $tm("navbar.profile") }} </a-menu-item>
|
||||||
|
<a-menu-item key="stories"> {{ $tm("navbar.account") }} </a-menu-item>
|
||||||
|
<a-menu-item key="drafts"> {{ $tm("navbar.account") }} </a-menu-item>
|
||||||
|
<a-menu-item key="reviews"> {{ $tm("navbar.reviews") }} </a-menu-item>
|
||||||
|
<a-menu-item key="messages"> {{ $tm("navbar.messages") }} </a-menu-item>
|
||||||
</a-sub-menu>
|
</a-sub-menu>
|
||||||
<a-menu-item key="admin" v-if="data?.user?.profile.isAdmin || false">
|
<a-menu-item key="admin" v-if="data?.user?.profile.isAdmin || false">
|
||||||
Admin
|
{{ $tm("navbar.admin") }}
|
||||||
|
</a-menu-item>
|
||||||
|
<a-menu-item key="logout" v-if="!!data?.user">
|
||||||
|
{{ $tm("navbar.logout") }}
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item key="logout" v-if="!!data?.user"> Logout </a-menu-item>
|
|
||||||
</a-menu>
|
</a-menu>
|
||||||
<div>
|
<div>
|
||||||
<a-button
|
<a-button
|
||||||
v-if="data?.user"
|
v-if="data?.user"
|
||||||
type="primary"
|
type="primary"
|
||||||
tooltip="Post a new Story"
|
:tooltip="$tm('newStoryButton')"
|
||||||
@click="() => navigateTo('/new-story')"
|
@click="() => navigateTo('/new-story')"
|
||||||
>
|
>
|
||||||
<!-- <template #icon>
|
<!-- <template #icon>
|
||||||
</template> -->
|
</template> -->
|
||||||
<icon istyle="regular" name="file-plus" />
|
<icon istyle="regular" name="file-plus" />
|
||||||
<span style="margin-left: 0.5em"> Post a new Story </span>
|
<span style="margin-left: 0.5em"> {{ $tm("newStoryButton") }} </span>
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="acbut" v-if="!data">
|
<div class="acbut" v-if="!data">
|
||||||
<a-button size="large" @click="() => navigateTo('/login')">
|
<a-button size="large" @click="() => navigateTo('/login')">
|
||||||
Log In
|
{{ $tm("navbar.login") }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
size="large"
|
size="large"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="() => navigateTo('/register')"
|
@click="() => navigateTo('/register')"
|
||||||
>
|
>
|
||||||
Register
|
{{ $tm("navbar.register") }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
} from "ant-design-vue/es/menu/src/interface";
|
} from "ant-design-vue/es/menu/src/interface";
|
||||||
import { ItemType, theme } from "ant-design-vue";
|
import { ItemType, theme } from "ant-design-vue";
|
||||||
import Icon from "../icon.vue";
|
import Icon from "../icon.vue";
|
||||||
import { ISidebarItem } from "~/models/sidebarEntry";
|
import { ISidebarItem } from "@models/sidebarEntry";
|
||||||
import { AButton, NuxtLink } from "#components";
|
import { AButton, NuxtLink } from "#components";
|
||||||
|
|
||||||
const loaded = inject<Ref<boolean>>("loaded");
|
const loaded = inject<Ref<boolean>>("loaded");
|
||||||
@ -16,6 +16,7 @@
|
|||||||
const selState = ref<string>("");
|
const selState = ref<string>("");
|
||||||
|
|
||||||
const { data: injecto } = await useApiFetch<ISidebarItem[]>("/sidebar");
|
const { data: injecto } = await useApiFetch<ISidebarItem[]>("/sidebar");
|
||||||
|
const { tm, rt } = useI18n();
|
||||||
|
|
||||||
let items: Ref<ItemType[]> = ref([
|
let items: Ref<ItemType[]> = ref([
|
||||||
{
|
{
|
||||||
@ -57,7 +58,9 @@
|
|||||||
} as SubMenuType,
|
} as SubMenuType,
|
||||||
{
|
{
|
||||||
key: "fun-features",
|
key: "fun-features",
|
||||||
label: h("span", { class: "smallcaps" }, ["Fun features"]),
|
label: h("span", { class: "smallcaps" }, [
|
||||||
|
rt(tm<string>("sidebar.features")),
|
||||||
|
]),
|
||||||
icon: h(Icon, {
|
icon: h(Icon, {
|
||||||
istyle: "regular",
|
istyle: "regular",
|
||||||
name: "sparkles",
|
name: "sparkles",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import singleStory from "~/components/listings/singleStory.vue";
|
import singleStory from "~/components/listings/singleStory.vue";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
let curPage = ref(route.query.page || 1);
|
let curPage = ref(route.query.page || 1);
|
||||||
const props = defineProps<{ prefix?: string; items?: IStory[] }>();
|
const props = defineProps<{ prefix?: string; items?: IStory[] }>();
|
||||||
@ -25,32 +25,39 @@
|
|||||||
// page
|
// page
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
// let {data: data } = await useApiFetch(`${props.prefix}/stories`, {
|
let { data: data } = await useApiFetch(`${props.prefix}`, {
|
||||||
// query: {
|
query: {
|
||||||
// page: curPage
|
page: curPage,
|
||||||
// }
|
},
|
||||||
// })
|
});
|
||||||
// rdata.value = data;
|
rdata.value = data.value;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<a-list
|
<div>
|
||||||
:pagination="{
|
<a-list :data-source="rdata.stories" item-layout="vertical">
|
||||||
|
<template #renderItem="{ item }">
|
||||||
|
<!-- {{ item.title }} -->
|
||||||
|
<single-story :story="item" />
|
||||||
|
</template>
|
||||||
|
</a-list>
|
||||||
|
<a-pagination
|
||||||
|
:default-page-size="20"
|
||||||
|
:total="rdata.total"
|
||||||
|
:default-current="curPage as number"
|
||||||
|
@change="pagiChange"
|
||||||
|
:show-quick-jumper="true"
|
||||||
|
:show-size-changer="false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<!-- {
|
||||||
defaultPageSize: 20,
|
defaultPageSize: 20,
|
||||||
total: rdata.total,
|
total: rdata.total,
|
||||||
defaultCurrent: curPage as number,
|
defaultCurrent: curPage as number,
|
||||||
// onChange: pagiChange,
|
onChange: pagiChange,
|
||||||
hideOnSinglePage: true,
|
// hideOnSinglePage: true,
|
||||||
showSizeChanger: false,
|
showSizeChanger: false,
|
||||||
}"
|
}-->
|
||||||
:data-source="rdata.stories"
|
|
||||||
item-layout="vertical"
|
|
||||||
>
|
|
||||||
<template #renderItem="{ item }">
|
|
||||||
<!-- {{ item.title }} -->
|
|
||||||
<single-story :story="item" />
|
|
||||||
</template>
|
|
||||||
</a-list>
|
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.ant-list-items > * + * {
|
.ant-list-items > * + * {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const [messageApi, contextHolder] = message.useMessage();
|
||||||
|
|
||||||
const props = defineProps<{ user: IUser | null }>();
|
const props = defineProps<{ user: IUser | null }>();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { IReview } from "~/models/stories/review";
|
import { IReview } from "@models/stories/review";
|
||||||
import singleReview from "./singleReview.vue";
|
import singleReview from "./singleReview.vue";
|
||||||
import { SingleChapterResult } from "~/lib/client/types/slightlyDifferentStory";
|
import { SingleChapterResult } from "@client/types/slightlyDifferentStory";
|
||||||
const props = defineProps<{ endpoint: string }>();
|
const props = defineProps<{ endpoint: string }>();
|
||||||
const story = inject<SingleChapterResult>("story");
|
const story = inject<SingleChapterResult>("story");
|
||||||
const { data: reviews } = (await useApiFetch<IReview[]>(
|
const { data: reviews } = (await useApiFetch<IReview[]>(
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { Form as veeForm, Field as veeField, useForm } from "vee-validate";
|
import { Form as veeForm, Field as veeField, useForm } from "vee-validate";
|
||||||
import { IReview } from "~/models/stories/review";
|
import { IReview } from "@models/stories/review";
|
||||||
import { comment } from "~/lib/client/editorConfig";
|
import { comment } from "@client/editorConfig";
|
||||||
import { SingleChapterResult } from "~/lib/client/types/slightlyDifferentStory";
|
import { SingleChapterResult } from "@client/types/slightlyDifferentStory";
|
||||||
const props = defineProps<{ review: IReview; story: SingleChapterResult }>();
|
const props = defineProps<{ review: IReview; story: SingleChapterResult }>();
|
||||||
const review = toRef(props.review);
|
const review = toRef(props.review);
|
||||||
const story = toRef(props.story);
|
const story = toRef(props.story);
|
||||||
@ -75,11 +75,16 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #author>
|
<template #author>
|
||||||
<b style="display: flex">
|
<b style="display: flex">
|
||||||
<span v-if="review.replyingTo == null">Review by </span>
|
<i18n-t keypath="reviews.reviewFrom" v-if="review.replyingTo == null">
|
||||||
<span v-else> Response from </span>
|
<nuxt-link :to="`/user/${review.author._id}`">
|
||||||
<nuxt-link :to="`/user/${review.author._id}`">
|
{{ review.author.username }}
|
||||||
{{ review.author.username }}
|
</nuxt-link>
|
||||||
</nuxt-link>
|
</i18n-t>
|
||||||
|
<i18n-t keypath="reviews.responseFrom" v-else>
|
||||||
|
<nuxt-link :to="`/user/${review.author._id}`">
|
||||||
|
{{ review.author.username }}
|
||||||
|
</nuxt-link>
|
||||||
|
</i18n-t>
|
||||||
</b>
|
</b>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DefaultOptionType } from "ant-design-vue/es/select";
|
import { DefaultOptionType } from "ant-design-vue/es/select";
|
||||||
import { RuleExpression, useField } from "vee-validate";
|
import { RuleExpression, useField } from "vee-validate";
|
||||||
import { cs } from "~/lib/client/storyFormSchema";
|
import { cs } from "@client/storyFormSchema";
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
|
|
||||||
import iconEl from "../icon.vue";
|
import iconEl from "../icon.vue";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { RuleExpression, useField } from "vee-validate";
|
import { RuleExpression, useField } from "vee-validate";
|
||||||
import { cs } from "~/lib/client/storyFormSchema";
|
import { cs } from "@client/storyFormSchema";
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
const fname = inject<string>("curName");
|
const fname = inject<string>("curName");
|
||||||
const { sb: selectedBands } = inject<any>("selectedBands");
|
const { sb: selectedBands } = inject<any>("selectedBands");
|
||||||
const allBands = inject<Ref<IBand[]>>("bandlist");
|
const allBands = inject<Ref<IBand[]>>("bandlist");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { Field, useFieldArray } from "vee-validate";
|
import { Field, useFieldArray } from "vee-validate";
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
|
|
||||||
const { sb: selectedBands } = inject<any>("selectedBands");
|
const { sb: selectedBands } = inject<any>("selectedBands");
|
||||||
const allBands = inject<Ref<IBand[]>>("bandlist");
|
const allBands = inject<Ref<IBand[]>>("bandlist");
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
ErrorMessage,
|
ErrorMessage,
|
||||||
} from "vee-validate";
|
} from "vee-validate";
|
||||||
import { NamePath } from "ant-design-vue/es/form/interface";
|
import { NamePath } from "ant-design-vue/es/form/interface";
|
||||||
import { FormChapter } from "~/lib/client/types/form/story";
|
import { FormChapter } from "@client/types/form/story";
|
||||||
|
|
||||||
import { story, bare } from "~/lib/client/editorConfig";
|
import { story, bare } from "@client/editorConfig";
|
||||||
import elBands from "../atoms/bands.vue";
|
import elBands from "../atoms/bands.vue";
|
||||||
import genre from "../atoms/genre.vue";
|
import genre from "../atoms/genre.vue";
|
||||||
import elCharacters from "../atoms/characters.vue";
|
import elCharacters from "../atoms/characters.vue";
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
FieldEntry,
|
FieldEntry,
|
||||||
useForm,
|
useForm,
|
||||||
} from "vee-validate";
|
} from "vee-validate";
|
||||||
import { storySchema } from "~/lib/client/storyFormSchema";
|
import { storySchema } from "@client/storyFormSchema";
|
||||||
import {
|
import {
|
||||||
FormChapter,
|
FormChapter,
|
||||||
FormStory,
|
FormStory,
|
||||||
defaultChapter,
|
defaultChapter,
|
||||||
} from "~/lib/client/types/form/story";
|
} from "@client/types/form/story";
|
||||||
import { autoEdit, autoSave } from "~/lib/client/utils";
|
import { autoEdit, autoSave } from "@client/utils";
|
||||||
|
|
||||||
import findUser from "~/components/findUser.vue";
|
import findUser from "~/components/findUser.vue";
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
useField,
|
useField,
|
||||||
ErrorMessage,
|
ErrorMessage,
|
||||||
} from "vee-validate";
|
} from "vee-validate";
|
||||||
import { story } from "~/lib/client/editorConfig";
|
import { story } from "@client/editorConfig";
|
||||||
import icon from "~/components/icon.vue";
|
import icon from "~/components/icon.vue";
|
||||||
import baseEditor from "../../baseEditor.vue";
|
import baseEditor from "../../baseEditor.vue";
|
||||||
const fname = inject<string>("curName");
|
const fname = inject<string>("curName");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { LabeledValue } from "ant-design-vue/es/select";
|
import { LabeledValue } from "ant-design-vue/es/select";
|
||||||
import { SingleChapterResult } from "~/lib/client/types/slightlyDifferentStory";
|
import { SingleChapterResult } from "@client/types/slightlyDifferentStory";
|
||||||
|
|
||||||
const { params } = useRoute();
|
const { params } = useRoute();
|
||||||
const cidx = parseInt(params.cidx as string);
|
const cidx = parseInt(params.cidx as string);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { type SingleChapterResult } from "~/lib/client/types/slightlyDifferentStory";
|
import { type SingleChapterResult } from "@client/types/slightlyDifferentStory";
|
||||||
import icon from "~/components/icon.vue";
|
import icon from "~/components/icon.vue";
|
||||||
const story = inject<SingleChapterResult | null>("story");
|
const story = inject<SingleChapterResult | null>("story");
|
||||||
console.log("storyyy--info", story);
|
console.log("storyyy--info", story);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
import cfooter from "~/components/layouts/footer.vue";
|
import cfooter from "~/components/layouts/footer.vue";
|
||||||
import sidebarThing from "~/components/layouts/sidebar.vue";
|
import sidebarThing from "~/components/layouts/sidebar.vue";
|
||||||
import icon from "~/components/icon.vue";
|
import icon from "~/components/icon.vue";
|
||||||
import { ISidebarItem } from "~/models/sidebarEntry";
|
import { ISidebarItem } from "@models/sidebarEntry";
|
||||||
const { useToken } = theme;
|
const { useToken } = theme;
|
||||||
const { token } = useToken();
|
const { token } = useToken();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { SingleChapterResult } from "./types/slightlyDifferentStory";
|
import { SingleChapterResult } from "./types/slightlyDifferentStory";
|
||||||
import { IChapter } from "~/models/stories/chapter";
|
import { IChapter } from "@models/stories/chapter";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
|
|
||||||
export const storyMiddleware = defineNuxtRouteMiddleware(async (to, from) => {
|
export const storyMiddleware = defineNuxtRouteMiddleware(async (to, from) => {
|
||||||
const { getSession } = useAuth();
|
const { getSession } = useAuth();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { type IStory } from "~/models/stories";
|
import { type IStory } from "@models/stories";
|
||||||
import { IChapter } from "~/models/stories/chapter";
|
import { IChapter } from "@models/stories/chapter";
|
||||||
|
|
||||||
export type SingleChapterResult = Omit<IStory, "chapters"> & {
|
export type SingleChapterResult = Omit<IStory, "chapters"> & {
|
||||||
currentChapter: IChapter & { text: string };
|
currentChapter: IChapter & { text: string };
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { debounce } from "lodash-es";
|
import { debounce } from "lodash-es";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { useAutoSaveStore } from "~/stores/autosaveStore";
|
import { useAutoSaveStore } from "~/stores/autosaveStore";
|
||||||
|
|
||||||
export const autoSave = debounce(async (values: any) => {
|
export const autoSave = debounce(async (values: any) => {
|
||||||
|
@ -4,7 +4,7 @@ import { resolve } from "path";
|
|||||||
// import iconv from "iconv-lite";
|
// import iconv from "iconv-lite";
|
||||||
import { GridFSBucketReadStream } from "mongodb";
|
import { GridFSBucketReadStream } from "mongodb";
|
||||||
import { stripHtml } from "string-strip-html";
|
import { stripHtml } from "string-strip-html";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { ficsHidden } from "./server/ficmas";
|
import { ficsHidden } from "./server/ficmas";
|
||||||
import { PreMiddlewareFunction, Query } from "mongoose";
|
import { PreMiddlewareFunction, Query } from "mongoose";
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { H3Event, EventHandlerRequest } from "h3";
|
import { H3Event, EventHandlerRequest } from "h3";
|
||||||
import { GridFSBucket } from "mongodb";
|
import { GridFSBucket } from "mongodb";
|
||||||
import mongoose, { Document } from "mongoose";
|
import mongoose, { Document } from "mongoose";
|
||||||
import { norm, stringifyStream } from "~/lib/functions";
|
import { norm, stringifyStream } from "@functions";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { IChapter } from "~/models/stories/chapter";
|
import { IChapter } from "@models/stories/chapter";
|
||||||
import getBucket from "../storyHelpers/getBucket";
|
import getBucket from "../storyHelpers/getBucket";
|
||||||
import { SingleChapterResult } from "~/lib/client/types/slightlyDifferentStory";
|
import { SingleChapterResult } from "@client/types/slightlyDifferentStory";
|
||||||
|
|
||||||
export default async function (
|
export default async function (
|
||||||
story: Document<number, {}, IStory> & IStory,
|
story: Document<number, {}, IStory> & IStory,
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
import { Band } from "~/models/band";
|
import { Band } from "@models/band";
|
||||||
import { Challenge } from "~/models/challenges/gen";
|
import { Challenge } from "@models/challenges/gen";
|
||||||
import { IStory, Story } from "~/models/stories";
|
import { IStory, Story } from "@models/stories";
|
||||||
import { log } from "../logger";
|
import { log } from "../logger";
|
||||||
import { H3Event, EventHandlerRequest } from "h3";
|
import { H3Event, EventHandlerRequest, H3EventContext } from "h3";
|
||||||
|
|
||||||
export default async function (
|
export default async function (
|
||||||
query,
|
query: any,
|
||||||
context,
|
context: H3EventContext,
|
||||||
ev: H3Event<EventHandlerRequest>,
|
ev: H3Event<EventHandlerRequest>,
|
||||||
limit: number = 0,
|
limit: number = 0,
|
||||||
sort?,
|
sort?: any,
|
||||||
): Promise<{ stories: IStory[]; total: number }> {
|
): Promise<{ stories: IStory[]; total: number }> {
|
||||||
const q = getQuery(ev);
|
const q = getQuery(ev);
|
||||||
let skipAmt = limit * (parseInt((q.page as string) || "1") - 1) - 1;
|
let skipAmt = limit * (parseInt((q.page as string) || "1") - 1);
|
||||||
if (skipAmt < 0) skipAmt = 0;
|
if (skipAmt < 0) skipAmt = 0;
|
||||||
query["chapters.hidden"] = false;
|
query["chapters.hidden"] = false;
|
||||||
if (context.currentUser) {
|
if (context.currentUser) {
|
||||||
@ -22,7 +22,7 @@ export default async function (
|
|||||||
query["author"]["$nin"] = context.currentUser.hiddenAuthors;
|
query["author"]["$nin"] = context.currentUser.hiddenAuthors;
|
||||||
}
|
}
|
||||||
query["ficmas"] = {
|
query["ficmas"] = {
|
||||||
$nin: context.ficmasarray_raw.map((a) => a._id),
|
$nin: context.ficmasarray_raw!.map((a) => a._id),
|
||||||
};
|
};
|
||||||
let stories = await Story.find(query, null)
|
let stories = await Story.find(query, null)
|
||||||
.collation({ locale: "en" })
|
.collation({ locale: "en" })
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import type { H3Event, EventHandlerRequest } from "h3";
|
import type { H3Event, EventHandlerRequest } from "h3";
|
||||||
import { Challenge } from "~/models/challenges/gen";
|
import { Challenge } from "@models/challenges/gen";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
|
import isIdNan from "@server/middlewareButNotReally/isIdNan";
|
||||||
export default async function (ev: H3Event<EventHandlerRequest>) {
|
export default async function (ev: H3Event<EventHandlerRequest>) {
|
||||||
const id = parseInt(getRouterParam(ev, "id") as string);
|
const id = isIdNan(ev);
|
||||||
const chapterIndex = ev.context.chapterIndex;
|
const chapterIndex = ev.context.chapterIndex;
|
||||||
if (isNaN(id) || isNaN(chapterIndex))
|
if (isNaN(id) || isNaN(chapterIndex))
|
||||||
throw createError({
|
throw createError({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { H3Event, EventHandlerRequest } from "h3";
|
import type { H3Event, EventHandlerRequest } from "h3";
|
||||||
import { isFicmasHidden } from "~/lib/functions";
|
import { isFicmasHidden } from "@functions";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { messages } from "../constants";
|
import { messages } from "../constants";
|
||||||
export default async function (
|
export default async function (
|
||||||
event: H3Event<EventHandlerRequest>,
|
event: H3Event<EventHandlerRequest>,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { H3Event, EventHandlerRequest } from "h3";
|
import type { H3Event, EventHandlerRequest } from "h3";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { IDraft } from "~/models/stories/draft";
|
import { IDraft } from "@models/stories/draft";
|
||||||
export function canDelete(event: H3Event<EventHandlerRequest>, story: IStory) {
|
export function canDelete(event: H3Event<EventHandlerRequest>, story: IStory) {
|
||||||
isLoggedIn(event);
|
isLoggedIn(event);
|
||||||
return (
|
return (
|
||||||
@ -9,6 +9,13 @@ export function canDelete(event: H3Event<EventHandlerRequest>, story: IStory) {
|
|||||||
story.author._id === event.context.currentUser?._id
|
story.author._id === event.context.currentUser?._id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export function canDeleteDraft(
|
||||||
|
event: H3Event<EventHandlerRequest>,
|
||||||
|
story: IDraft,
|
||||||
|
) {
|
||||||
|
isLoggedIn(event);
|
||||||
|
return story.author === event.context.currentUser?._id;
|
||||||
|
}
|
||||||
export function canModify(
|
export function canModify(
|
||||||
event: H3Event<EventHandlerRequest>,
|
event: H3Event<EventHandlerRequest>,
|
||||||
story: IStory | IDraft,
|
story: IStory | IDraft,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { Biffno } from "~/models/challenges/biffno";
|
import { Biffno } from "@models/challenges/biffno";
|
||||||
import { Ficmas } from "~/models/challenges/ficmas";
|
import { Ficmas } from "@models/challenges/ficmas";
|
||||||
import { Challenge } from "~/models/challenges/gen";
|
import { Challenge } from "@models/challenges/gen";
|
||||||
import { log } from "./logger";
|
import { log } from "./logger";
|
||||||
|
|
||||||
export default async function () {
|
export default async function () {
|
||||||
@ -17,6 +17,9 @@ export default async function () {
|
|||||||
// if (!!!mongoose.connections.length)
|
// if (!!!mongoose.connections.length)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
throw createError({ statusCode: 500, message: "whoops." });
|
throw createError({
|
||||||
|
statusCode: 500,
|
||||||
|
message: "Could not connect to the database.",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import { marked } from "marked";
|
|||||||
import mammoth from "mammoth";
|
import mammoth from "mammoth";
|
||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import { sanitizeConf } from "../constants";
|
import { sanitizeConf } from "../constants";
|
||||||
import { FormChapter } from "~/lib/client/types/form/story";
|
import { FormChapter } from "@client/types/form/story";
|
||||||
import { log } from "../logger";
|
import { log } from "../logger";
|
||||||
|
|
||||||
export default async function (bodyObj: FormChapter): Promise<string> {
|
export default async function (bodyObj: FormChapter): Promise<string> {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import { FormChapter } from "~/lib/client/types/form/story";
|
import { FormChapter } from "@client/types/form/story";
|
||||||
import { countWords } from "~/lib/functions";
|
import { IChapter } from "@models/stories/chapter";
|
||||||
import { IChapter } from "~/models/stories/chapter";
|
|
||||||
import { sanitizeConf } from "../constants";
|
import { sanitizeConf } from "../constants";
|
||||||
import bodyHandler from "./bodyHandler";
|
|
||||||
|
|
||||||
export default function (c: FormChapter): IChapter {
|
export default function (c: FormChapter): IChapter {
|
||||||
let t: IChapter = {
|
let t: IChapter = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import mongoose, { connect, Document, Model } from "mongoose";
|
import mongoose, { connect, Document, Model } from "mongoose";
|
||||||
const { Schema, model } = mongoose;
|
const { Schema, model } = mongoose;
|
||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
|
|
||||||
const AutoIncrement = SequenceFactory(mongoose);
|
const AutoIncrement = SequenceFactory(mongoose);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
|
|
||||||
const AutoIncrement = SequenceFactory(mongoose);
|
const AutoIncrement = SequenceFactory(mongoose);
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ import mongoose, {
|
|||||||
model,
|
model,
|
||||||
} from "mongoose";
|
} from "mongoose";
|
||||||
|
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
|
|
||||||
const AutoIncrement = SequenceFactory(mongoose);
|
const AutoIncrement = SequenceFactory(mongoose);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
|
|
||||||
const AutoIncrement = SequenceFactory(mongoose);
|
const AutoIncrement = SequenceFactory(mongoose);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
import { IUser } from "./user";
|
import { IUser } from "./user";
|
||||||
|
|
||||||
const AutoIncrement = SequenceFactory(mongoose);
|
const AutoIncrement = SequenceFactory(mongoose);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
export interface IChapter {
|
export interface IChapter {
|
||||||
title: string;
|
title: string;
|
||||||
summary: string;
|
summary: string;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { IStory } from ".";
|
import { IStory } from ".";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
import { IFicmas } from "~/models/challenges/ficmas";
|
import { IFicmas } from "@models/challenges/ficmas";
|
||||||
import { IChallenge } from "~/models/challenges/gen";
|
import { IChallenge } from "@models/challenges/gen";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
import { Chapter } from "./chapter";
|
import { Chapter } from "./chapter";
|
||||||
|
@ -4,10 +4,10 @@ import SequenceFactory from "mongoose-sequence";
|
|||||||
const AutoIncrement = SequenceFactory(mongoose);
|
const AutoIncrement = SequenceFactory(mongoose);
|
||||||
|
|
||||||
import { Chapter, IChapter } from "./chapter";
|
import { Chapter, IChapter } from "./chapter";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
import { Ficmas, IFicmas } from "~/models/challenges/ficmas";
|
import { Ficmas, IFicmas } from "@models/challenges/ficmas";
|
||||||
import { IChallenge, Challenge } from "~/models/challenges/gen";
|
import { IChallenge, Challenge } from "@models/challenges/gen";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
|
|
||||||
export interface IStory {
|
export interface IStory {
|
||||||
_id?: number;
|
_id?: number;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
import { populate, populateSelected } from "~/lib/functions";
|
import { populate, populateSelected } from "@functions";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
|
|
||||||
const AutoIncrement = SequenceFactory(mongoose);
|
const AutoIncrement = SequenceFactory(mongoose);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import SequenceFactory from "mongoose-sequence";
|
|||||||
import bcrypt from "bcryptjs";
|
import bcrypt from "bcryptjs";
|
||||||
import md5 from "blueimp-md5";
|
import md5 from "blueimp-md5";
|
||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
import { hasMigrated } from "~/lib/dbconfig";
|
import { hasMigrated } from "@dbconfig";
|
||||||
import { IBand } from "./band";
|
import { IBand } from "./band";
|
||||||
import { IStory } from "./stories/index";
|
import { IStory } from "./stories/index";
|
||||||
import { QuickMenuItem, QuickMenuSchema } from "./quickMenu";
|
import { QuickMenuItem, QuickMenuSchema } from "./quickMenu";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
// import speedkitHydrate from "nuxt-speedkit/dist/runtime/hydrate.mjs";
|
// import speedkitHydrate from "nuxt-speedkit/dist/runtime/hydrate.mjs";
|
||||||
|
|
||||||
export type SessionData = IUser;
|
export type SessionData = IUser;
|
||||||
@ -32,8 +32,12 @@ export default defineNuxtConfig({
|
|||||||
"@pinia/nuxt",
|
"@pinia/nuxt",
|
||||||
"@vueuse/nuxt",
|
"@vueuse/nuxt",
|
||||||
"nuxt-speedkit",
|
"nuxt-speedkit",
|
||||||
|
"@nuxtjs/i18n",
|
||||||
// "./modules/09.loaded",
|
// "./modules/09.loaded",
|
||||||
],
|
],
|
||||||
|
i18n: {
|
||||||
|
vueI18n: `./i18n.config.ts`,
|
||||||
|
},
|
||||||
speedkit: {
|
speedkit: {
|
||||||
disableNuxtFontaine: true,
|
disableNuxtFontaine: true,
|
||||||
lazyOffset: {
|
lazyOffset: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import icon from "~/components/icon.vue";
|
import icon from "~/components/icon.vue";
|
||||||
import { bp, subscriptions } from "~/lib/client/listActions";
|
import { bp, subscriptions } from "@client/listActions";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
|
|
||||||
const { data: authors } = (await useApiFetch<any[]>("/authors")) as {
|
const { data: authors } = (await useApiFetch<any[]>("/authors")) as {
|
||||||
data: Ref<any[]>;
|
data: Ref<any[]>;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import storyList from "~/components/listings/stories.vue";
|
import storyList from "~/components/listings/stories.vue";
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { data: band } = await useApiFetch<IBand>(`/band/${route.params.id}`);
|
const { data: band } = await useApiFetch<IBand>(`/band/${route.params.id}`);
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { IBand } from "~/models/band";
|
import { IBand } from "@models/band";
|
||||||
import icon from "~/components/icon.vue";
|
import icon from "~/components/icon.vue";
|
||||||
import { subscriptions, bp } from "~/lib/client/listActions";
|
import { subscriptions, bp } from "@client/listActions";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
|
|
||||||
const { data: bands } = (await useApiFetch<NonNullable<IBand[]>>(
|
const { data: bands } = (await useApiFetch<NonNullable<IBand[]>>(
|
||||||
"/band/all",
|
"/band/all",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import storyForm from "~/components/story/create/storyform.vue";
|
import storyForm from "~/components/story/create/storyform.vue";
|
||||||
import { defaultStory } from "~/lib/client/types/form/story";
|
import { defaultStory } from "@client/types/form/story";
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: ["auth"],
|
middleware: ["auth"],
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import { useChallengeV2 } from "vue-recaptcha";
|
import { useChallengeV2 } from "vue-recaptcha";
|
||||||
import { notification } from "ant-design-vue";
|
import { notification } from "ant-design-vue";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
import termsOfServices from "~/components/tos.vue";
|
import termsOfServices from "~/components/tos.vue";
|
||||||
useRecaptchaProvider();
|
useRecaptchaProvider();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { SingleChapterResult } from "~/lib/client/types/slightlyDifferentStory";
|
import { SingleChapterResult } from "@client/types/slightlyDifferentStory";
|
||||||
import { theme } from "ant-design-vue";
|
import { theme } from "ant-design-vue";
|
||||||
import { storyMiddleware } from "~/lib/client/middleware";
|
import { storyMiddleware } from "@client/middleware";
|
||||||
import forChapter from "~/components/reviews/forChapter.vue";
|
import forChapter from "~/components/reviews/forChapter.vue";
|
||||||
import storyInfo from "~/components/story/view/storyInfo.vue";
|
import storyInfo from "~/components/story/view/storyInfo.vue";
|
||||||
import chapterPicker from "~/components/story/view/chapterPicker.vue";
|
import chapterPicker from "~/components/story/view/chapterPicker.vue";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { storyMiddleware } from "~/lib/client/middleware";
|
import { storyMiddleware } from "@client/middleware";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: [storyMiddleware],
|
middleware: [storyMiddleware],
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
import storyForm from "~/components/story/create/storyform.vue";
|
import storyForm from "~/components/story/create/storyform.vue";
|
||||||
import { FormStory } from "~/lib/client/types/form/story";
|
import { FormStory } from "@client/types/form/story";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { IChapter } from "~/models/stories/chapter";
|
import { IChapter } from "@models/stories/chapter";
|
||||||
|
|
||||||
import { storyEditMiddleware } from "~/lib/client/middleware";
|
import { storyEditMiddleware } from "@client/middleware";
|
||||||
const rtr = useRoute();
|
const rtr = useRoute();
|
||||||
const {
|
const {
|
||||||
data: { value: originalStory },
|
data: { value: originalStory },
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { format, formatDistanceToNow, formatRelative } from "date-fns";
|
import { format, formatDistanceToNow, formatRelative } from "date-fns";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { favourites } from "~/lib/client/listActions";
|
import { favourites } from "@client/listActions";
|
||||||
import singleStory from "~/components/listings/singleStory.vue";
|
import singleStory from "~/components/listings/singleStory.vue";
|
||||||
import icon from "~/components/icon.vue";
|
import icon from "~/components/icon.vue";
|
||||||
import adminPanel from "~/components/profile/adminPanel.vue";
|
import adminPanel from "~/components/profile/adminPanel.vue";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import * as net from "net";
|
import * as net from "net";
|
||||||
import plugnplay from "~/lib/server/plugnplay";
|
import plugnplay from "@server/plugnplay";
|
||||||
import { Biffno } from "~/models/challenges/biffno";
|
import { Biffno } from "@models/challenges/biffno";
|
||||||
import { Ficmas } from "~/models/challenges/ficmas";
|
import { Ficmas } from "@models/challenges/ficmas";
|
||||||
import { Challenge } from "~/models/challenges/gen";
|
import { Challenge } from "@models/challenges/gen";
|
||||||
export default defineNuxtPlugin({
|
export default defineNuxtPlugin({
|
||||||
name: "mongo",
|
name: "mongo",
|
||||||
// enforce: 'pre',
|
// enforce: 'pre',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const q = getQuery(ev);
|
const q = getQuery(ev);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
import { IUser, User } from "~/models/user";
|
import { IUser, User } from "@models/user";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
const wrongMsg = "wrong credentials";
|
const wrongMsg = "wrong credentials";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { weirdToNormalChars as w2nc } from "weird-to-normal-chars";
|
import { weirdToNormalChars as w2nc } from "weird-to-normal-chars";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import { usernameRegex } from "~/lib/server/constants";
|
import { usernameRegex } from "@server/constants";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import captcha from "~/lib/server/middlewareButNotReally/captcha";
|
import captcha from "@server/middlewareButNotReally/captcha";
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
const body = await readBody(event);
|
const body = await readBody(event);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
export default eventHandler((event) => {
|
export default eventHandler((event) => {
|
||||||
let ahead = (
|
let ahead = (
|
||||||
getHeaders(event).authorization ||
|
getHeaders(event).authorization ||
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
let authorSingleton: {
|
let authorSingleton: {
|
||||||
lastRefreshed: number;
|
lastRefreshed: number;
|
||||||
data: {
|
data: {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import { Band } from "~/models/band";
|
import { Band } from "@models/band";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const id = parseInt(getRouterParam(ev, "id") as string);
|
const id = parseInt(getRouterParam(ev, "id") as string);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import isAdmin from "~/lib/server/middlewareButNotReally/isAdmin";
|
import isAdmin from "@server/middlewareButNotReally/isAdmin";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { Band, IBand } from "~/models/band";
|
import { Band, IBand } from "@models/band";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isAdmin(ev);
|
isAdmin(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { listQuerier } from "~/lib/server/dbHelpers";
|
import { listQuerier } from "@server/dbHelpers";
|
||||||
import { Band } from "~/models/band";
|
import { Band } from "@models/band";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
const params = getRouterParams(event);
|
const params = getRouterParams(event);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Band } from "~/models/band";
|
import { Band } from "@models/band";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
|
|
||||||
export default cachedEventHandler(async (ev) => {
|
export default cachedEventHandler(async (ev) => {
|
||||||
let bands = await Band.find({
|
let bands = await Band.find({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { usernameRegex } from "~/lib/server/constants";
|
import { usernameRegex } from "@server/constants";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
const query = getQuery(event);
|
const query = getQuery(event);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { usernameRegex } from "~/lib/server/constants";
|
import { usernameRegex } from "@server/constants";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
const query = getQuery(event);
|
const query = getQuery(event);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { listQuerier } from "~/lib/server/dbHelpers";
|
import { listQuerier } from "@server/dbHelpers";
|
||||||
import { Story } from "~/models/stories";
|
import { log } from "@server/logger";
|
||||||
import { log } from "~/lib/server/logger";
|
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const s = await listQuerier({}, ev.context, ev, 20, {
|
const s = await listQuerier({}, ev.context, ev, 20, {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
import { Review } from "~/models/stories/review";
|
import { Review } from "@models/stories/review";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { Review } from "~/models/stories/review";
|
import { Review } from "@models/stories/review";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
import { Review } from "~/models/stories/review";
|
import { Review } from "@models/stories/review";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { SidebarItem } from "~/models/sidebarEntry";
|
import { SidebarItem } from "@models/sidebarEntry";
|
||||||
|
|
||||||
export default cachedEventHandler(async (ev) => {
|
export default cachedEventHandler(async (ev) => {
|
||||||
const si = await SidebarItem.find({});
|
const si = await SidebarItem.find({});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { chapterTransformer } from "~/lib/server/dbHelpers";
|
import { chapterTransformer } from "@server/dbHelpers";
|
||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import storyCheck from "~/lib/server/middlewareButNotReally/storyCheck";
|
import storyCheck from "@server/middlewareButNotReally/storyCheck";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const story = await storyQuerier(ev);
|
const story = await storyQuerier(ev);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { FormChapter } from "~/lib/client/types/form/story";
|
import { FormChapter } from "@client/types/form/story";
|
||||||
import { countWords } from "~/lib/functions";
|
import { countWords } from "@functions";
|
||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { canModify } from "~/lib/server/middlewareButNotReally/storyPrivileges";
|
import { canModify } from "@server/middlewareButNotReally/storyPrivileges";
|
||||||
import { replaceOrUploadContent, bodyHandler } from "~/lib/server/storyHelpers";
|
import { replaceOrUploadContent, bodyHandler } from "@server/storyHelpers";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import { Review } from "~/models/stories/review";
|
import { Review } from "@models/stories/review";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
let story = await storyQuerier(ev);
|
let story = await storyQuerier(ev);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
import { Review } from "~/models/stories/review";
|
import { Review } from "@models/stories/review";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import { chapterTransformer } from "~/lib/server/dbHelpers";
|
import { chapterTransformer } from "@server/dbHelpers";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import { canDelete } from "~/lib/server/middlewareButNotReally/storyPrivileges";
|
import { canDelete } from "@server/middlewareButNotReally/storyPrivileges";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const tmpS = await storyQuerier(ev);
|
const tmpS = await storyQuerier(ev);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import storyCheck from "~/lib/server/middlewareButNotReally/storyCheck";
|
import storyCheck from "@server/middlewareButNotReally/storyCheck";
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const story = await storyQuerier(ev);
|
const story = await storyQuerier(ev);
|
||||||
let chrs = await storyCheck(ev, story, 0);
|
let chrs = await storyCheck(ev, story, 0);
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
import { Readable } from "stream";
|
import { Readable } from "stream";
|
||||||
import { Document } from "mongoose";
|
import { Document } from "mongoose";
|
||||||
import { IStory, Story } from "~/models/stories";
|
import { IStory, Story } from "@models/stories";
|
||||||
import { FormStory } from "~/lib/client/types/form/story";
|
import { FormStory } from "@client/types/form/story";
|
||||||
import { storyQuerier } from "~/lib/server/dbHelpers";
|
import { storyQuerier } from "@server/dbHelpers";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { canModify } from "~/lib/server/middlewareButNotReally/storyPrivileges";
|
import { canModify } from "@server/middlewareButNotReally/storyPrivileges";
|
||||||
import {
|
import {
|
||||||
bodyHandler,
|
bodyHandler,
|
||||||
getBucket,
|
getBucket,
|
||||||
modelFormChapter,
|
modelFormChapter,
|
||||||
replaceOrUploadContent,
|
replaceOrUploadContent,
|
||||||
} from "~/lib/server/storyHelpers";
|
} from "@server/storyHelpers";
|
||||||
import { countWords } from "~/lib/functions";
|
import { countWords } from "@functions";
|
||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
let os:
|
let os:
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
import isIdNan from "@server/middlewareButNotReally/isIdNan";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const id = parseInt(getRouterParam(ev, "id") as string);
|
const id = isIdNan(ev);
|
||||||
let dat = await User.find({
|
let dat = await User.find({
|
||||||
"favs.stories": {
|
"favs.stories": {
|
||||||
$in: [id],
|
$in: [id],
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import { Readable } from "stream";
|
import { Readable } from "stream";
|
||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import { FormStory } from "~/lib/client/types/form/story";
|
import { FormStory } from "@client/types/form/story";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import {
|
import { getBucket, bodyHandler, modelFormChapter } from "@server/storyHelpers";
|
||||||
getBucket,
|
import { Story } from "@models/stories";
|
||||||
bodyHandler,
|
import { sanitizeConf } from "@server/constants";
|
||||||
modelFormChapter,
|
import { countWords } from "@functions";
|
||||||
} from "~/lib/server/storyHelpers";
|
|
||||||
import { Story } from "~/models/stories";
|
|
||||||
import { sanitizeConf } from "~/lib/server/constants";
|
|
||||||
import { countWords } from "~/lib/functions";
|
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
let authorSingleton: {
|
let authorSingleton: {
|
||||||
lastRefreshed: number;
|
lastRefreshed: number;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { writeFileSync } from "fs";
|
import { writeFileSync } from "fs";
|
||||||
import { extname } from "path";
|
import { extname } from "path";
|
||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
import { ContentFilenameRegex } from "~/lib/server/constants";
|
import { ContentFilenameRegex } from "@server/constants";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const noMultipart = "no multipart data found!???!?";
|
const noMultipart = "no multipart data found!???!?";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import isAdmin from "~/lib/server/middlewareButNotReally/isAdmin";
|
import isAdmin from "@server/middlewareButNotReally/isAdmin";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import isAdmin from "~/lib/server/middlewareButNotReally/isAdmin";
|
import isAdmin from "@server/middlewareButNotReally/isAdmin";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import { Ficmas } from "~/models/challenges/ficmas";
|
import { Ficmas } from "@models/challenges/ficmas";
|
||||||
import { Challenge } from "~/models/challenges/gen";
|
import { Challenge } from "@models/challenges/gen";
|
||||||
import { IUser, User } from "~/models/user";
|
import { IUser, User } from "@models/user";
|
||||||
|
|
||||||
export default cachedEventHandler(async (ev) => {
|
export default cachedEventHandler(async (ev) => {
|
||||||
const id = parseInt(getRouterParam(ev, "id")!);
|
const id = parseInt(getRouterParam(ev, "id")!);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { messages } from "~/lib/server/constants";
|
import { messages } from "@server/constants";
|
||||||
import isAdmin from "~/lib/server/middlewareButNotReally/isAdmin";
|
import isAdmin from "@server/middlewareButNotReally/isAdmin";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { listQuerier } from "~/lib/server/dbHelpers";
|
import { listQuerier } from "@server/dbHelpers";
|
||||||
|
|
||||||
export default cachedEventHandler(async (ev) => {
|
export default cachedEventHandler(async (ev) => {
|
||||||
const id = parseInt(getRouterParam(ev, "id")!);
|
const id = parseInt(getRouterParam(ev, "id")!);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { FavPayload, SubPayload } from "~/lib/client/types/form/favSub";
|
import { FavPayload, SubPayload } from "@client/types/form/favSub";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { HidePayload } from "~/lib/client/types/form/favSub";
|
import { HidePayload } from "@client/types/form/favSub";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import { weirdToNormalChars } from "weird-to-normal-chars";
|
import { weirdToNormalChars } from "weird-to-normal-chars";
|
||||||
import { Profile, MyStuff } from "~/lib/client/types/form/myStuff";
|
import { Profile, MyStuff } from "@client/types/form/myStuff";
|
||||||
import { apiRoot, messages } from "~/lib/server/constants";
|
import { apiRoot, messages } from "@server/constants";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { Review } from "~/models/stories/review";
|
import { Review } from "@models/stories/review";
|
||||||
import { IUser, User } from "~/models/user";
|
import { IUser, User } from "@models/user";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
function emsg(arg: string): any {
|
function emsg(arg: string): any {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import san from "sanitize-html";
|
import san from "sanitize-html";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Profile } from "~/lib/client/types/form/myStuff";
|
import { Profile } from "@client/types/form/myStuff";
|
||||||
import { apiRoot, h2m } from "~/lib/server/constants";
|
import { apiRoot, h2m } from "@server/constants";
|
||||||
import forumId from "~/lib/server/forumId";
|
import forumId from "@server/forumId";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { Story } from "~/models/stories";
|
import { Story } from "@models/stories";
|
||||||
import { Review } from "~/models/stories/review";
|
import { Review } from "@models/stories/review";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { SubPayload } from "~/lib/client/types/form/favSub";
|
import { SubPayload } from "@client/types/form/favSub";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "@server/middlewareButNotReally/isLoggedIn";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
isLoggedIn(ev);
|
isLoggedIn(ev);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
import plugnplay from "~/lib/server/plugnplay";
|
import plugnplay from "@server/plugnplay";
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
log.info("middleware connecting", { label: "middleware/db" });
|
log.info("middleware connecting", { label: "middleware/db" });
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
import { User } from "~/models/user";
|
import { User } from "@models/user";
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
let ahead = (
|
let ahead = (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Ficmas } from "~/models/challenges/ficmas";
|
import { Ficmas } from "@models/challenges/ficmas";
|
||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
let y = new Date().getFullYear();
|
let y = new Date().getFullYear();
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
import { log } from "@server/logger";
|
||||||
|
|
||||||
export default eventHandler((ev) => {
|
export default eventHandler((ev) => {
|
||||||
let chapParam = getRouterParams(ev).chapter;
|
let chapParam = getRouterParams(ev).chapter;
|
||||||
|
log.silly(JSON.stringify(getRouterParams(ev)), { label: "sigh" });
|
||||||
ev.context.chapterIndex = !!chapParam ? parseInt(chapParam) - 1 : 0;
|
ev.context.chapterIndex = !!chapParam ? parseInt(chapParam) - 1 : 0;
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { log } from "~/lib/server/logger";
|
import { log } from "@server/logger";
|
||||||
|
|
||||||
export default eventHandler(async (ev) => {
|
export default eventHandler(async (ev) => {
|
||||||
const p = log.startTimer();
|
const p = log.startTimer();
|
||||||
|
@ -2,6 +2,17 @@
|
|||||||
"extends": "../.nuxt/tsconfig.server.json",
|
"extends": "../.nuxt/tsconfig.server.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"outDir": "../out"
|
"outDir": "../out",
|
||||||
|
"paths": {
|
||||||
|
"@models/*": ["../models/*"],
|
||||||
|
"@client/*": ["./lib/client/*"],
|
||||||
|
"@server/*": ["../lib/server/*"],
|
||||||
|
"@models/**": ["../models/**"],
|
||||||
|
"@client/**": ["../lib/client/**"],
|
||||||
|
"@server/**": ["../lib/server/**"],
|
||||||
|
"@functions": ["../lib/functions.ts"],
|
||||||
|
"@dbconfig": ["../lib/dbconfig.ts"],
|
||||||
|
"@constants": ["../lib/constants.ts"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,17 @@
|
|||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"noImplicitThis": false,
|
"noImplicitThis": false,
|
||||||
"verbatimModuleSyntax": false
|
"verbatimModuleSyntax": false,
|
||||||
|
"paths": {
|
||||||
|
"@models/*": ["./models/*"],
|
||||||
|
"@client/*": ["./lib/client/*"],
|
||||||
|
"@server/*": ["./lib/server/*"],
|
||||||
|
"@client/**": ["./lib/client/**"],
|
||||||
|
"@models/**": ["./models/**"],
|
||||||
|
"@server/**": ["./lib/server/**"],
|
||||||
|
"@functions": ["./lib/functions.ts"],
|
||||||
|
"@dbconfig": ["./lib/dbconfig.ts"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"extends": "./.nuxt/tsconfig.json"
|
"extends": "./.nuxt/tsconfig.json"
|
||||||
}
|
}
|
||||||
|
2
typings/auth.d.ts
vendored
2
typings/auth.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
import { SessionData as SDI } from "#auth";
|
import { SessionData as SDI } from "#auth";
|
||||||
|
|
||||||
declare module "#auth" {
|
declare module "#auth" {
|
||||||
|
4
typings/express.d.ts
vendored
4
typings/express.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import { Document } from "mongoose";
|
import { Document } from "mongoose";
|
||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
import { IUser } from "~/models/user";
|
import { IUser } from "@models/user";
|
||||||
import { Request } from "express";
|
import { Request } from "express";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { IStory } from "~/models/stories";
|
import { IStory } from "@models/stories";
|
||||||
|
|
||||||
export interface StoryFetchResult {
|
export interface StoryFetchResult {
|
||||||
stories: IStory[];
|
stories: IStory[];
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user