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