Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"i18n-ally.localesPaths": ["i18n/locales"]
}
15 changes: 15 additions & 0 deletions app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright links
// Do not modify please
const GITHUB_OWNER = 'FreeNowOrg'
const GITHUB_REPO = 'PixivNow'

export default defineAppConfig({
version: '4.0.0',
SITE_ENV: import.meta.dev ? 'development' : 'production',
GITHUB_OWNER,
GITHUB_REPO,
GITHUB_URL: `https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}`,
PROJECT_NAME: 'PixivNow',
PROJECT_TAGLINE: 'Enjoy Pixiv Now (pixiv.js.org)',
IMAGE_CACHE_SECONDS: 12 * 60 * 60 * 1000,
})
7 changes: 0 additions & 7 deletions app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ NaiveuiProvider#app-full-container(
</template>

<script lang="ts" setup>
import NaiveuiProvider from '~/components/NaiveuiProvider.vue'
import NProgress from '~/components/NProgress.vue'
import SiteHeader from '~/components/SiteHeader.vue'
import SiteFooter from '~/components/SiteFooter.vue'
import { existsSessionId, initUser } from '~/composables/userData'
import { useUserStore } from '~/stores/session'

const SideNav = defineAsyncComponent(
() => import('~/components/SideNav/SideNav.vue')
)
Expand Down
13 changes: 0 additions & 13 deletions app/auto-imports.d.ts

This file was deleted.

34 changes: 0 additions & 34 deletions app/components.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions app/components/ArtTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ NTag.artwork-tag(
</template>

<script lang="ts" setup>
import { NTag } from 'naive-ui'

defineProps<{ tag: string }>()
</script>

Expand Down
4 changes: 0 additions & 4 deletions app/components/Artwork/ArtworkCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,11 @@
</template>

<script lang="ts" setup>
import DeferLoad from '../DeferLoad.vue'
import { NSkeleton } from 'naive-ui'
import { IllustType } from '~/utils/constants'
import IFasEye from '~icons/fa-solid/eye'
import IFasHeart from '~icons/fa-solid/heart'
import IFasImages from '~icons/fa-solid/images'
import IFasRobot from '~icons/fa-solid/robot'
import IPlayCircle from '~icons/fa-solid/play-circle'
import type { ArtworkInfo } from '~/types'

const props = defineProps<{
item?: ArtworkInfo
Expand Down
24 changes: 17 additions & 7 deletions app/components/Artwork/ArtworkLargeCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
:alt='illust.title',
:src='illust.url.replace("p0_master", "p0_square")'
)
.restrict.x-restrict(aria-label='R-18' role='img' title='R-18' v-if='illust.xRestrict === 2')
.restrict.x-restrict(
aria-label='R-18'
role='img'
title='R-18'
v-if='illust.xRestrict === 2'
)
IFasEye(aria-hidden='true')
.restrict.ai-restrict(aria-label='AI生成' role='img' title='AI生成' v-if='illust.aiType === 2')
.restrict.ai-restrict(
aria-label='AI生成'
role='img'
title='AI生成'
v-if='illust.aiType === 2'
)
IFasRobot(aria-hidden='true')
.page-count(
:title='"共 " + illust.pageCount + " 张"'
Expand All @@ -27,17 +37,17 @@
RouterLink(:to='"/artworks/" + illust.id') {{ illust.title }}
.author(:title='illust.userName')
RouterLink(:to='"/users/" + illust.userId')
img.avatar(:alt='illust.userName' :src='illust.profileImageUrl' lazyload)
img.avatar(
:alt='illust.userName',
:src='illust.profileImageUrl'
lazyload
)
| {{ illust.userName }}
.tags
ArtTag(:key='_', :tag='item' v-for='(item, _) in illust.tags')
</template>

<script lang="ts" setup>
import type { ArtworkInfo } from '~/types'
import { IllustType } from '~/utils/constants'
import DeferLoad from '../DeferLoad.vue'
import ArtTag from '../ArtTag.vue'
import IFasEye from '~icons/fa-solid/eye'
import IFasImages from '~icons/fa-solid/images'
import IFasRobot from '~icons/fa-solid/robot'
Expand Down
2 changes: 0 additions & 2 deletions app/components/Artwork/ArtworkLargeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Waterfall.artwork-large-list(
</template>

<script lang="ts" setup>
import ArtworkLargeCard from './ArtworkLargeCard.vue'
import type { ArtworkInfo, ArtworkRank } from '~/types'
import { Waterfall } from 'vue-waterfall-plugin-next'
import 'vue-waterfall-plugin-next/dist/style.css'

Expand Down
7 changes: 2 additions & 5 deletions app/components/Artwork/ArtworkList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ Component.artworks-list(
x-scrollable
)
template(v-if='loading')
li(v-for='i in skeletonNumber' :key='"skeleton-" + i')
li(:key='"skeleton-" + i' v-for='i in skeletonNumber')
ArtworkCard(loading)
template(v-else)
li(v-for='item in artworks' :key='item.id')
li(:key='item.id' v-for='item in artworks')
ArtworkCard(:item='item')
</template>

<script lang="ts" setup>
import ArtworkCard from './ArtworkCard.vue'
import { isArtwork } from '~/utils'
import type { ArtworkInfo, ArtworkInfoOrAd } from '~/types'
import { NScrollbar } from 'naive-ui'

const props = defineProps<{
Expand Down
23 changes: 7 additions & 16 deletions app/components/Artwork/ArtworkListByUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,10 @@
</template>

<script setup lang="ts">
import type { ArtworkInfo } from '~/types'
import { NPagination } from 'naive-ui'
import { useUserArtworksStore } from '~/stores/user-artworks'

const props = withDefaults(
defineProps<{
userId: string
workCategory?: 'illust' | 'manga'
}>(),
{
workCategory: 'illust',
}
)
const { userId, workCategory = 'illust' } = defineProps<{
userId: string
workCategory?: 'illust' | 'manga'
}>()

const containerRef = ref<HTMLElement>()
const curPage = ref(1)
Expand All @@ -48,7 +39,7 @@ onMounted(async () => {
})
watch(curPage, (page) => {
backToTop()
userArtworksStore.fetchPage(props.userId, page, props.workCategory)
userArtworksStore.fetchPage(userId, page, workCategory)
})

function backToTop() {
Expand All @@ -63,8 +54,8 @@ function backToTop() {
async function firstInit() {
userArtworksStore.reset()
curPage.value = 1
await userArtworksStore.fetchAllIds(props.userId, props.workCategory)
await userArtworksStore.fetchPage(props.userId, 1, props.workCategory)
await userArtworksStore.fetchAllIds(userId, workCategory)
await userArtworksStore.fetchPage(userId, 1, workCategory)
}
</script>

Expand Down
17 changes: 8 additions & 9 deletions app/components/AuthorCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
.author-inner(v-if='user')
.flex-center
.left
RouterLink(:to='"/users/" + user.userId' :aria-label='"查看作者: " + user.name')
img(:alt='user.name + " 的头像"' :src='user.imageBig')
RouterLink(
:aria-label='"查看作者: " + user.name',
:to='"/users/" + user.userId'
)
img(:alt='user.name + " 的头像"', :src='user.imageBig')
.right
.flex
h4.plain
Expand Down Expand Up @@ -35,23 +38,19 @@
</template>

<script lang="ts" setup>
import ArtworkList from './Artwork/ArtworkList.vue'
import type { User } from '~/types'
import { NButton, NEllipsis, NSkeleton } from 'naive-ui'
import IFasCheck from '~icons/fa-solid/check'
import IFasPlus from '~icons/fa-solid/plus'
import { useUserStore } from '~/stores/session'

const userStore = useUserStore()

const props = defineProps<{
const { user } = defineProps<{
user?: User
}>()

const loadingUserFollow = ref(false)
const pixivClient = usePixivClientStore().client
function handleUserFollow() {
if (!props.user || loadingUserFollow.value) return
const user = props.user
if (!user || loadingUserFollow.value) return

loadingUserFollow.value = true
const isFollowed = user.isFollowed
Expand Down
2 changes: 0 additions & 2 deletions app/components/Comment/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ li.comment-block

<script lang="ts" setup>
import stampList from './stampList.json'
import type { Comments } from '~/types'
import { useUserStore } from '~/stores/session'

defineProps<{ comment: Comments }>()
const store = useUserStore()
Expand Down
25 changes: 11 additions & 14 deletions app/components/Comment/CommentArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,20 @@
</template>

<script lang="ts" setup>
import Comment from './Comment.vue'
import type { Comments } from '~/types'
import { NButton } from 'naive-ui'
import IFasPlus from '~icons/fa-solid/plus'

const loading = ref(false)
const comments = ref<Comments[]>([])
const hasNext = ref(false)

const props = defineProps<{
const { id, count } = defineProps<{
id: string
count: number
}>()

async function init(id: string | number): Promise<void> {
if (loading.value) return
if (!props.count) {
if (!count) {
hasNext.value = false
comments.value = []
loading.value = false
Expand All @@ -48,6 +45,7 @@ async function init(id: string | number): Promise<void> {

try {
loading.value = true
const pixivClient = usePixivClientStore().client
const data = await pixivClient.getComments(`${id}`, {
limit: comments.value.length ? 30 : 3,
offset: comments.value.length,
Expand All @@ -68,16 +66,15 @@ function pushComment(data: Comments) {

const commentsArea = ref<HTMLDivElement | null>(null)

const ob = useIntersectionObserver(
commentsArea,
async ([{ isIntersecting }]) => {
if (isIntersecting) {
await nextTick()
init(props.id)
ob.stop()
}
const ob = useIntersectionObserver(commentsArea, async (entries) => {
if (entries.length === 0) return
const isIntersecting = entries[0]!.isIntersecting
if (isIntersecting) {
await nextTick()
init(id)
ob.stop()
}
)
})
</script>

<style scoped lang="sass">
Expand Down
6 changes: 3 additions & 3 deletions app/components/Comment/CommentSubmit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

<script lang="ts" setup>
import Cookies from 'js-cookie'
import { useUserStore } from '~/stores/session'
import axios from 'axios'

const store = useUserStore()

const loading = ref(false)
const comment = ref('')

const props = defineProps<{ id: string }>()
const { id } = defineProps<{ id: string }>()
const emit = defineEmits<{
(
e: 'push-comment',
Expand All @@ -45,7 +45,7 @@ async function submit(): Promise<void> {
`/ajax/illusts/comments/post`,
{
type: 'comment',
illust_id: props.id,
illust_id: id,
author_user_id: store.userId,
comment,
},
Expand Down
10 changes: 6 additions & 4 deletions app/components/DeferLoad.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Component(
</template>

<script lang="ts" setup>
const props = defineProps<{
const { src, width, height } = defineProps<{
src: string
width?: number
height?: number
Expand All @@ -22,7 +22,9 @@ const loaded = ref(false)
const error = ref(false)
const imgRef = ref<HTMLImageElement | null>(null)

const ob = useIntersectionObserver(imgRef, async ([{ isIntersecting }]) => {
const ob = useIntersectionObserver(imgRef, async (entries) => {
if (entries.length === 0) return
const isIntersecting = entries[0]!.isIntersecting
if (isIntersecting) {
await nextTick()
loadImage()
Expand All @@ -34,8 +36,8 @@ function loadImage() {
loaded.value = false
error.value = false

const img = new Image(props.width, props.height)
img.src = props.src
const img = new Image(width, height)
img.src = src
img.onload = () => {
loaded.value = true
error.value = false
Expand Down
Loading
Loading