惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
B
Blog
博客园 - 三生石上(FineUI控件)
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
Vercel News
Vercel News
量子位
A
About on SuperTechFans
博客园 - 聂微东
WordPress大学
WordPress大学
D
DataBreaches.Net
The Cloudflare Blog
M
MIT News - Artificial intelligence
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
雷峰网
雷峰网
C
Check Point Blog
S
SegmentFault 最新的问题
U
Unit 42
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research

RSS Minima activity

Commits · main · Dan Wolff / RSS Minima · GitLab Simplify focusability check - just use CSS selector (54a793c2) · Commits · Dan Wolff / RSS Minima · GitLab Add options for wraparound; remove "singleton" version: use more constants (9645e697) · Commits · Dan Wolff / RSS Minima · GitLab Keyboard nav: Extract constants (bbbc3736) · Commits · Dan Wolff / RSS Minima · GitLab Keyboard nav: Refactor (1c3d583a) · Commits · Dan Wolff / RSS Minima · GitLab Refactor keyboard nav (b7f4c485) · Commits · Dan Wolff / RSS Minima · GitLab 89b30bd99cd47db3f069b1afa1dab30ae768e80f to af96dfe02ba2e1bb1f8e305ec418e1dff4b4ef11 · Dan Wolff / RSS Minima · GitLab a28898e0b013a75a7f103049894ecab36ae3f990 to 46ac7df8d6b151c6c6f1eede52fdb75a5dca4ce4 · Dan Wolff / RSS Minima · GitLab ef463f06d6b3e3850441482fba774d61a91ab477 to a28898e0b013a75a7f103049894ecab36ae3f990 · Dan Wolff / RSS Minima · GitLab 339ccf9ac2206fdd123a9a38b5c9b05c426392e7 to ef463f06d6b3e3850441482fba774d61a91ab477 · Dan Wolff / RSS Minima · GitLab Support enabling and disabling feeds (339ccf9a) · Commits · Dan Wolff / RSS Minima · GitLab 3dcfae9d95512e48127a97effc2cc5071b60ecdd to 085fced8c32f6a71b9b256fa44828d016dd5fc9b · Dan Wolff / RSS Minima · GitLab Show the add feed form in the 'highlight' area (3dcfae9d) · Commits · Dan Wolff / RSS Minima · GitLab 6346d59cd010c1513ac9b7d4bf0a67424eb2d3b0 to 1df02a1b329902ab0e56fd1976851b8c0f715e65 · Dan Wolff / RSS Minima · GitLab c4da933b50794d649c07324c051c8b60ed45a770 to 6346d59cd010c1513ac9b7d4bf0a67424eb2d3b0 · Dan Wolff / RSS Minima · GitLab e21d4054912d86e30be16c105f916d35661ccb6f to c4da933b50794d649c07324c051c8b60ed45a770 · Dan Wolff / RSS Minima · GitLab Update readme (e21d4054) · Commits · Dan Wolff / RSS Minima · GitLab f6bc674460abacff785466f41feba4f73d3140d6 to fe6633a595231107eeb35f03b1d202fe1bd67626 · Dan Wolff / RSS Minima · GitLab Dan Wolff / RSS Minima · GitLab
Support specifying a copy format, e.g. a yt-dlp command (...
Dan Wolff · 2024-03-02 · via RSS Minima activity
Commit 89b30bd9 authored by Dan Wolff's avatar Dan Wolff
Browse files

Support specifying a copy format, e.g. a yt-dlp command

Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ import {
  markFeedAsUnread,
  refreshFeed,
  removeFeed,
  setFeedCopyFormat,
  setFeedCustomName,
  setFeedEnabled,
  setFeedUpdateFrequency,
@@ -140,6 +141,24 @@ const HighlightFeed: FunctionComponent<HighlightFeedProps> = function ({
          }}
        />
      </div>
      <div>
        Copy format:{" "}
        <Select
          variant="transparent"
          value={feed.copyFormat}
          options={[
            { value: undefined, label: "URL" },
            { value: "yt-dlp", label: "yt-dlp downloader" },
            {
              value: "yt-dlp-sound",
              label: "yt-dlp downloader (sound only)",
            },
          ] as const}
          onOptionChange={(value) => {
            dispatch(setFeedCopyFormat, feedId, value);
          }}
        />
      </div>
      <div>
        Feed added: <RelativeTime time={feed.addedDateTime} />
      </div>
@@ -210,7 +229,7 @@ const HighlightFeed: FunctionComponent<HighlightFeedProps> = function ({
          {items.map((x) => (
            <li key={x.feedItemId}>
              <ListFeedEntry
                feedId={feedId}
                feed={feed}
                feedEntry={x}
                keyboardNavY={keyboardNavY++}
              />
Original line number Diff line number Diff line
@@ -128,25 +128,25 @@ const DetailsButton = forwardRef<HTMLAnchorElement, {
});

const EntriesList: FunctionComponent<{
  feedId: number;
  feed: Feed;
  text?: string;
  entries?: FeedItem[];
  showMoreText?: string;
  onShowMore?(): void;
  keyboardNavY: number;
}> = ({ feedId, text, entries, showMoreText, onShowMore, keyboardNavY }) => {
}> = ({ feed, text, entries, showMoreText, onShowMore, keyboardNavY }) => {
  const keyboardNav = useKeyboardNav();
  let localKeyboardNavY = 0;
  return (
    <>
      {text && <p class="italic opacity-50 pl-4 mb-1">{text}</p>}

      {entries && feedId !== undefined && (
      {entries && feed.feedId !== undefined && (
        <ul class="mb-2">
          {entries.map((x) => (
            <li key={x.feedItemId} class="ml-8">
              <ListFeedEntry
                feedId={feedId}
                feed={feed}
                feedEntry={x}
                keyboardNavY={[keyboardNavY, localKeyboardNavY++]}
              />
@@ -250,7 +250,7 @@ const ListFeed: FunctionComponent<ListFeedProps> = ({ feed, keyboardNavY }) => {

  const entriesList = enabled && expanded && (
    <EntriesList
      feedId={feedId}
      feed={feed}
      text={items.length === 0 && displayEntries === "all"
        ? "No entries"
        : undefined}
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ import {
  markAsRead,
  markAsUnread,
} from "../state/operations.ts";
import { FeedItem } from "../state/State.ts";
import { Feed, FeedItem } from "../state/State.ts";
import useAppState from "../state/useAppState.ts";
import CopyButton from "./CopyButton.tsx";
import IconButton from "./IconButton.tsx";
@@ -19,13 +19,13 @@ import listDisplayContext from "../lib/listDisplayContext.ts";
import useKeyboardNav from "../lib/useKeyboardNav.tsx";

interface ListFeedEntryProps {
  feedId: number;
  feed: Feed;
  feedEntry: FeedItem;
  keyboardNavY?: number | number[];
}

const ListFeedEntry: FunctionComponent<ListFeedEntryProps> = ({
  feedId,
  feed: { feedId, copyFormat },
  feedEntry,
  keyboardNavY = 0,
}) => {
@@ -39,6 +39,19 @@ const ListFeedEntry: FunctionComponent<ListFeedEntryProps> = ({
  const keyboardNav = useKeyboardNav({ y: keyboardNavY });
  let keyboardNavX = 0;

  let copyText: string, copyTitle: string;

  if (copyFormat === "yt-dlp" || copyFormat === "yt-dlp-sound") {
    const escapedUrl = url.replace(/[\\"]/g, "\\$&");
    copyText = copyFormat === "yt-dlp"
      ? `yt-dlp "${escapedUrl}"`
      : `yt-dlp -x "${escapedUrl}"`;
    copyTitle = `Copy command: ${copyText}`;
  } else {
    copyText = url;
    copyTitle = `Copy URL: ${url}`;
  }

  return (
    <div
      class={`flex gap-2 ${
@@ -48,8 +61,8 @@ const ListFeedEntry: FunctionComponent<ListFeedEntryProps> = ({
      <div class="whitespace-pre">
        <CopyButton
          ref={keyboardNav.add({ x: keyboardNavX++ })}
          title={`Copy URL: ${url}`}
          text={url}
          title={copyTitle}
          text={copyText}
        />

        {toggleRead.node}
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import {
import { upsertFeedItems } from "./db/feedItem.ts";
import { updateUser } from "./db/user.ts";
import {
  CopyFormat,
  deleteUserFeed,
  getUserFeedByUrl,
  insertUserFeed,
@@ -180,6 +181,14 @@ export default class BackEndApi {
    updateUserFeed({ userId: this.#userId, feedId, updateFrequencyMinutes });
  }

  setFeedCopyFormat(feedId: number, copyFormat?: CopyFormat) {
    updateUserFeed({
      userId: this.#userId,
      feedId,
      copyFormat: copyFormat ?? null,
    });
  }

  setFeedEnabled(feedId: number, enabled: boolean) {
    updateUserFeed({ userId: this.#userId, feedId, enabled });
  }
Original line number Diff line number Diff line
export default {
  id: "11_add_userFeed.copyFormat",
  sql: `
    ALTER TABLE userFeed
    ADD COLUMN copyFormat TEXT NULL;
    `,
};