Skip to content

Commit

Permalink
Merge branch 'RSSNext:dev' into newtab-broswer
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryc127 authored Sep 28, 2024
2 parents 485587c + 3dd705f commit 46896d2
Show file tree
Hide file tree
Showing 55 changed files with 2,016 additions and 2,072 deletions.
47 changes: 14 additions & 33 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,7 @@ env:
NODE_OPTIONS: --max-old-space-size=8192

jobs:
check-for-changes:
runs-on: ubuntu-latest
# outputs:
# should_run: ${{ steps.check.outputs.should_run }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: Check for code changes
# id: check
# run: |
# git diff --quiet @{1.day.ago} HEAD -- ':!.github' || echo "should_run=true" >> $GITHUB_OUTPUT

nightly-release:
# needs: check-for-changes
# if: needs.check-for-changes.outputs.should_run == 'true'
runs-on: ${{ matrix.os }}

strategy:
Expand Down Expand Up @@ -107,25 +92,20 @@ jobs:
shell: bash
run: |
# Get the current version from package.json
if [ -f package.json ]; then
CURRENT_VERSION=$(node -p "require('./package.json').version")
# Remove any existing prerelease identifier (e.g., -alpha.1)
BASE_VERSION=$(echo $CURRENT_VERSION | sed -E 's/(-[a-zA-Z]+\.[0-9]+)$//')
# Generate the nightly version
NIGHTLY_DATE=$(date +'%Y%m%d')
NIGHTLY_VERSION="${BASE_VERSION}-nightly.${NIGHTLY_DATE}"
echo "NIGHTLY_VERSION=$NIGHTLY_VERSION" >> $GITHUB_ENV
# Update version in package.json
if [[ "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json
else
sed -i '' "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json
fi
echo "Updated version to $NIGHTLY_VERSION"
CURRENT_VERSION=$(node -p "require('./package.json').version")
# Remove any existing prerelease identifier (e.g., -alpha.1)
BASE_VERSION=$(echo $CURRENT_VERSION | sed -E 's/(-[a-zA-Z]+\.[0-9]+)$//')
# Generate the nightly version
NIGHTLY_DATE=$(date +'%Y%m%d')
NIGHTLY_VERSION="${BASE_VERSION}-nightly.${NIGHTLY_DATE}"
echo "NIGHTLY_VERSION=$NIGHTLY_VERSION" >> $GITHUB_ENV
# Update version in package.json
if [[ "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json
else
echo "package.json not found"
exit 1
sed -i '' "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json
fi
echo "Updated version to $NIGHTLY_VERSION"
- name: Build
if: matrix.os != 'macos-latest'
Expand Down Expand Up @@ -171,6 +151,7 @@ jobs:
name: Nightly ${{ env.NIGHTLY_VERSION }}
draft: false
prerelease: true
tag_name: nightly-${{ env.NIGHTLY_VERSION }}
files: |
out/make/**/*.dmg
out/make/**/*.zip
Expand All @@ -179,7 +160,7 @@ jobs:
out/make/**/*.yml
body: |
This is an automated nightly release for testing purposes.
Version: ${{ env.NIGHTLY_VERSION }}
Version: 0.0.0-nightly.${{ env.NIGHTLY_VERSION }}
**Warning:** This build may be unstable and is not recommended for production use.
env:
Expand Down
65 changes: 64 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
"msedge-tts": "1.3.4",
"nanoid": "5.0.7",
"ofetch": "1.4.0",
"posthog-js": "1.163.0",
"posthog-js": "1.165.0",
"posthog-node": "4.2.0",
"semver": "7.6.3",
"vscode-languagedetection": "npm:@vscode/vscode-languagedetection@^1.0.22"
},
"devDependencies": {
"@types/lodash-es": "4.17.12",
"@types/node": "^22.5.5",
"@types/node": "^22.7.4",
"electron": "32.1.2",
"electron-devtools-installer": "3.2.0",
"hono": "4.6.2",
"hono": "4.6.3",
"typescript": "^5.6.2"
}
}
35 changes: 18 additions & 17 deletions apps/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"@headlessui/react": "2.1.8",
"@hono/auth-js": "1.0.10",
"@hookform/resolvers": "3.9.0",
"@iconify/tools": "4.0.6",
"@lottiefiles/dotlottie-react": "0.8.12",
"@iconify/tools": "4.0.7",
"@lottiefiles/dotlottie-react": "0.9.0",
"@microflash/remark-callout-directives": "4.3.1",
"@mozilla/readability": "^0.5.0",
"@radix-ui/react-alert-dialog": "1.1.1",
Expand All @@ -38,13 +38,13 @@
"@radix-ui/react-tabs": "1.1.0",
"@radix-ui/react-toast": "1.2.1",
"@radix-ui/react-tooltip": "1.1.2",
"@sentry/react": "8.30.0",
"@sentry/react": "8.32.0",
"@sentry/vite-plugin": "2.22.4",
"@shikijs/transformers": "1.18.0",
"@shikijs/transformers": "1.20.0",
"@t3-oss/env-core": "^0.11.1",
"@tanstack/query-sync-storage-persister": "5.56.2",
"@tanstack/react-query": "5.56.2",
"@tanstack/react-query-devtools": "5.56.2",
"@tanstack/react-query-devtools": "5.58.0",
"@tanstack/react-query-persist-client": "5.56.2",
"@use-gesture/react": "10.3.1",
"@yornaath/batshit": "0.10.1",
Expand All @@ -54,10 +54,10 @@
"cmdk": "1.0.0",
"dayjs": "1.11.13",
"dexie": "4.0.8",
"dnum": "^2.13.1",
"dnum": "^2.14.0",
"electron-log": "5.2.0",
"foxact": "0.2.38",
"framer-motion": "11.5.6",
"framer-motion": "11.9.0",
"franc-min": "6.2.0",
"fuse.js": "7.0.0",
"hast-util-to-jsx-runtime": "2.3.0",
Expand All @@ -73,9 +73,9 @@
"masonic": "4.0.1",
"nanoid": "5.0.7",
"ofetch": "1.4.0",
"path-to-regexp": "8.1.0",
"posthog-js": "1.163.0",
"re-resizable": "6.9.18",
"path-to-regexp": "8.2.0",
"posthog-js": "1.165.0",
"re-resizable": "6.10.0",
"react-blurhash": "^0.3.0",
"react-error-boundary": "4.0.13",
"react-fast-marquee": "1.6.5",
Expand All @@ -89,19 +89,19 @@
"react-shadow": "20.5.0",
"react-virtuoso": "4.10.4",
"rehype-infer-description-meta": "2.0.0",
"rehype-parse": "9.0.0",
"rehype-parse": "9.0.1",
"rehype-sanitize": "6.0.0",
"rehype-stringify": "10.0.0",
"rehype-stringify": "10.0.1",
"remark-directive": "3.0.0",
"remark-gfm": "4.0.0",
"remark-gh-alerts": "0.0.3",
"remark-parse": "11.0.0",
"remark-rehype": "11.1.1",
"shiki": "1.18.0",
"shiki": "1.20.0",
"sonner": "^1.5.0",
"swiper": "11.1.14",
"tailwind-merge": "2.5.2",
"tldts": "6.1.47",
"tldts": "6.1.48",
"unified": "11.0.5",
"use-context-selector": "2.0.0",
"usehooks-ts": "3.1.0",
Expand All @@ -113,12 +113,13 @@
"@babel/generator": "7.25.6",
"@hono/node-server": "1.13.1",
"@types/lodash-es": "4.17.12",
"@types/node": "^22.5.5",
"@types/react": "^18.3.8",
"@types/node": "^22.7.4",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"fake-indexeddb": "6.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.6.2"
"typescript": "^5.6.2",
"vitest": "2.0"
}
}
36 changes: 25 additions & 11 deletions apps/renderer/src/components/ui/media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ const MediaImpl: FC<MediaProps> = ({
: src,
)

const previewImageSrc = useMemo(
() =>
proxy && previewImageUrl
? getImageProxyUrl({
url: previewImageUrl,
width: proxy.width,
height: proxy.height,
})
: previewImageUrl,
[previewImageUrl, proxy],
)

const [mediaLoadState, setMediaLoadState] = useState<"loading" | "loaded" | "error">("loading")
const errorHandle: React.ReactEventHandler<HTMLImageElement> = useEventCallback((e) => {
if (imgSrc !== props.src) {
Expand Down Expand Up @@ -135,7 +147,7 @@ const MediaImpl: FC<MediaProps> = ({
)}
onClick={handleClick}
>
<VideoPreview src={src!} previewImageUrl={previewImageUrl} thumbnail={thumbnail} />
<VideoPreview src={src!} previewImageUrl={previewImageSrc} thumbnail={thumbnail} />
</span>
)
}
Expand All @@ -151,7 +163,7 @@ const MediaImpl: FC<MediaProps> = ({
mediaContainerClassName,
mediaLoadState,
popper,
previewImageUrl,
previewImageSrc,
props.height,
props.width,
rest,
Expand Down Expand Up @@ -201,7 +213,7 @@ const FallbackMedia: FC<MediaProps> = ({ type, mediaContainerClassName, classNam
className={cn(
!(props.width || props.height) && "size-full",
"center rounded bg-zinc-100 dark:bg-neutral-900",
"not-prose !flex max-h-full flex-col space-y-1 p-4",
"not-prose !flex max-h-full flex-col space-y-1 p-4 @container",

mediaContainerClassName,
)}
Expand All @@ -210,14 +222,16 @@ const FallbackMedia: FC<MediaProps> = ({ type, mediaContainerClassName, classNam
width: props.width ? `${props.width}px` : "100%",
}}
>
<i className="i-mgc-close-cute-re text-xl text-red-500" />
<p>Media loaded failed</p>
<div className="space-x-1 break-all px-4 text-sm">
Go to{" "}
<a href={props.src} target="_blank" rel="noreferrer" className="follow-link--underline">
{props.src}
</a>
<i className="i-mgc-external-link-cute-re translate-y-px" />
<div className="hidden @sm:hidden @md:contents">
<i className="i-mgc-close-cute-re text-xl text-red-500" />
<p>Media loaded failed</p>
<div className="space-x-1 break-all px-4 text-sm">
Go to{" "}
<a href={props.src} target="_blank" rel="noreferrer" className="follow-link--underline">
original media url
</a>
<i className="i-mgc-external-link-cute-re translate-y-0.5" />
</div>
</div>
</div>
</div>
Expand Down
16 changes: 7 additions & 9 deletions apps/renderer/src/components/ui/media/preview-media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { MediaModel } from "@follow/shared/hono"
import type { FC } from "react"
import { Fragment, useCallback, useEffect, useRef, useState } from "react"
import { Blurhash } from "react-blurhash"
import { useTranslation } from "react-i18next"
import { Keyboard, Mousewheel } from "swiper/modules"
import type { SwiperRef } from "swiper/react"
import { Swiper, SwiperSlide } from "swiper/react"
Expand All @@ -25,6 +26,7 @@ const Wrapper: Component<{
entryId?: string
}> = ({ children, src, showActions, entryId }) => {
const { dismiss } = useCurrentModal()
const { t } = useTranslation(["shortcuts", "external"])

return (
<div className="center relative size-full px-20 pb-8 pt-10" onClick={dismiss}>
Expand All @@ -50,7 +52,7 @@ const Wrapper: Component<{
<Fragment>
{!!window.electron && (
<ActionButton
tooltip="Download"
tooltip={t("external:header.download")}
onClick={() => {
tipcClient?.download(src)
}}
Expand All @@ -59,7 +61,7 @@ const Wrapper: Component<{
</ActionButton>
)}
<ActionButton
tooltip={COPY_MAP.OpenInBrowser()}
tooltip={t(COPY_MAP.OpenInBrowser())}
onClick={() => {
window.open(src)
}}
Expand Down Expand Up @@ -287,13 +289,9 @@ const FallbackableImage: FC<
{isLoading && !isAllError && (
<div className="center absolute inset-0 size-full">
{blurhash ? (
<Blurhash
hash={blurhash}
resolutionX={32}
resolutionY={32}
className="!size-full"
style={{ aspectRatio: `${props.width} / ${props.height}` }}
/>
<div style={{ aspectRatio: `${props.width} / ${props.height}` }} className="w-full">
<Blurhash hash={blurhash} resolutionX={32} resolutionY={32} className="!size-full" />
</div>
) : (
<i className="i-mgc-loading-3-cute-re size-8 animate-spin text-white/80" />
)}
Expand Down
10 changes: 6 additions & 4 deletions apps/renderer/src/modules/profile/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,20 @@ export const usePresentUserProfileModal = (variant: Variant = "dialog") => {
return useCallback(
(userId: string | undefined, overrideVariant?: Variant) => {
if (!userId) return
const finalVariant = overrideVariant || variant
present({
title: "User Profile",
content: () =>
createElement(UserProfileModalContent, {
userId,
variant: overrideVariant || variant,
variant: finalVariant,
}),
CustomModalComponent: PlainModal,
clickOutsideToDismiss: true,
modal: variant === "dialog",
overlay: variant === "dialog",
modalContainerClassName: variant === "drawer" ? "right-4 left-[auto] top-4 bottom-4" : "",
modal: finalVariant === "dialog",
overlay: finalVariant === "dialog",
modalContainerClassName:
finalVariant === "drawer" ? "right-4 left-[auto] top-4 bottom-4" : "",
})
},
[present, variant],
Expand Down
5 changes: 3 additions & 2 deletions apps/renderer/src/modules/profile/user-profile-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ export const UserProfileModalContent: FC<{
<Fragment>
<div
className={cn(
"center m-12 mb-4 flex shrink-0 flex-col",
"center m-12 mb-4 flex shrink-0 flex-col duration-700",
isHeaderSimple ? "mt-3 flex-row" : "flex-col",
)}
>
<Avatar
asChild
className={cn("aspect-square", isHeaderSimple ? "size-12" : "size-16")}
>
<m.span layout>
<m.span layout transition={{ duration: 0.35 }}>
<AvatarImage
className="duration-200 animate-in fade-in-0"
asChild
Expand All @@ -255,6 +255,7 @@ export const UserProfileModalContent: FC<{
</Avatar>
<m.div
layout
transition={{ duration: 0.35 }}
className={cn(
"flex cursor-text select-text flex-col items-center",
isHeaderSimple ? "ml-8 items-start" : "",
Expand Down
6 changes: 4 additions & 2 deletions apps/renderer/src/modules/settings/tabs/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,15 @@ export const LanguageSelector = () => {
const originalLanguageName = defaultResources[lang].lang.name
return (
<SelectItem className="group" key={lang} value={lang}>
<span className={cn(originalLanguageName !== languageName && "group-hover:hidden")}>
<span
className={cn(originalLanguageName !== languageName && "group-hover:invisible")}
>
{languageName}
{typeof percent === "number" ? (percent >= 100 ? null : ` (${percent}%)`) : null}
</span>
{originalLanguageName !== languageName && (
<span
className="hidden duration-500 animate-in fade-in-0 group-hover:block"
className="absolute inset-0 hidden items-center pl-2 group-hover:flex"
key={"org"}
>
{originalLanguageName}
Expand Down
Loading

0 comments on commit 46896d2

Please sign in to comment.