diff --git a/README.md b/README.md index 89a277c..7d1580e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ _**C**reate **O**nce **S**ync **E**verywhere_ ## 使用方法 -> 点击观看视频:[![Bilibili](https://img.shields.io/badge/Video-Bilibili-00A1D6?logo=bilibili&logoColor=white)](https://www.bilibili.com/video/BV1ZxqnB1E2C/) [![YouTube](https://img.shields.io/badge/Video-YouTube-FF0000?logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=KTskiA8Xaj4) +> 点击观看视频:[![Bilibili](https://img.shields.io/badge/Video-Bilibili-00A1D6?logo=bilibili&logoColor=white)](https://www.bilibili.com/video/BV1ZxqnB1E2C/) [![YouTube](https://img.shields.io/badge/Video-YouTube-FF0000?logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=KTskiA8Xaj4) 1. 先点击安装扩展 [![Chrome Web Store](https://img.shields.io/badge/Install-Chrome%20Web%20Store-4285F4?logo=googlechrome&logoColor=white)](https://chromewebstore.google.com/detail/ilhikcdphhpjofhlnbojifbihhfmmhfk) 然后打开 [md.doocs.org](https://md.doocs.org) 或本地开发环境 2. 编辑 Markdown 内容 @@ -34,7 +34,6 @@ _**C**reate **O**nce **S**ync **E**verywhere_ - 同步的标签页自动归入分组,便于管理 - 微信公众号同步时完整保留渲染样式并自动保存为草稿 - ## 已支持的平台 > 更多想要添加的平台欢迎提 [Issue](https://github.com/doocs/cose/issues) ! @@ -42,28 +41,27 @@ _**C**reate **O**nce **S**ync **E**verywhere_ >
> 已支持平台速查表(点击展开) > -> | 字母 | 平台 | -> |:---:|:---| -> | A | 阿里云社区 | -> | B | B站专栏、百度云千帆、百家号、博客园 | -> | C | CSDN | -> | D | 电子发烧友、抖音文章 | -> | H | 华为开发者文章、华为云博客、火山引擎社区 | -> | I | InfoQ | -> | J | 简书、掘金、今日头条 | -> | K | 开源中国 | -> | M | Medium、ModelScope 魔搭社区 | -> | S | 少数派、搜狐号、思否 | -> | T | 腾讯云 | -> | W | 网易号、微博文章、微信公众号 | -> | X | 小红书长文、X(Formerly Twitter) Articles | -> | Z | 支付宝开放平台、知乎 | -> | 5 | 51CTO | +> | 字母 | 平台 | +> | :--: | :--------------------------------------- | +> | A | 阿里云社区 | +> | B | B站专栏、百度云千帆、百家号、博客园 | +> | C | CSDN | +> | D | 电子发烧友、抖音文章 | +> | H | 华为开发者文章、华为云博客、火山引擎社区 | +> | I | InfoQ | +> | J | 简书、掘金、今日头条 | +> | K | 开源中国 | +> | L | llmapis.com | +> | M | Medium、ModelScope 魔搭社区 | +> | S | 少数派、搜狐号、思否 | +> | T | 腾讯云 | +> | W | 网易号、微博文章、微信公众号 | +> | X | 小红书长文、X(Formerly Twitter) Articles | +> | Z | 支付宝开放平台、知乎 | +> | 5 | 51CTO | > >
- - ### 媒体平台
@@ -80,11 +78,12 @@ _**C**reate **O**nce **S**ync **E**verywhere_ B站专栏 少数派 X(Formerly Twitter) Articles +llmapis.com
- ### 博客平台 +
CSDN @@ -100,6 +99,7 @@ _**C**reate **O**nce **S**ync **E**verywhere_
### 云平台及其开发者社区 +
@@ -124,7 +124,6 @@ _**C**reate **O**nce **S**ync **E**verywhere_
- ## 开发者模式测试 1. 克隆或下载本项目 @@ -132,3 +131,7 @@ _**C**reate **O**nce **S**ync **E**verywhere_ 3. 开启右上角的 **开发者模式** 4. 点击 **加载已解压的扩展程序** 5. 选择 `cose` 目录 + +LLMAPIS + +_Partnership with [https://llmapis.com](https://llmapis.com) - Discover more awesome tools and resources_ diff --git a/manifest.json b/manifest.json index dd31161..24cbd42 100644 --- a/manifest.json +++ b/manifest.json @@ -49,7 +49,8 @@ "https://*.volcengine.com/*", "https://*.douyin.com/*", "https://*.xiaohongshu.com/*", - "https://*.elecfans.com/*" + "https://*.elecfans.com/*", + "https://*.llmapis.com/*" ], "action": { "default_icon": { diff --git a/src/background.js b/src/background.js index 30da7e9..b19b8f4 100644 --- a/src/background.js +++ b/src/background.js @@ -4369,6 +4369,37 @@ function fillContentOnPage(content, platformId) { console.log('[COSE] ModelScope 未找到编辑器') } } + // LLMAPIS + else if (host.includes('llmapis.com')) { + // 填充内容 (标题会作为 H2 添加到内容开头) + const contentTextarea = await waitFor('#content', 5000) + if (contentTextarea) { + contentTextarea.focus() + + // 组合标题和内容: 使用 H2 格式的标题 + 原始内容 + const finalContent = title ? `## ${title}\n\n${contentToFill}` : contentToFill + + // 使用原生 setter 填充值 (绕过 React 的受控组件限制) + const nativeSetter = Object.getOwnPropertyDescriptor( + window.HTMLTextAreaElement.prototype, 'value' + ).set + nativeSetter.call(contentTextarea, finalContent) + + // 触发 input 事件以更新 React 状态 + contentTextarea.dispatchEvent(new Event('input', { bubbles: true })) + contentTextarea.dispatchEvent(new Event('change', { bubbles: true })) + + // 更新字数统计 + const charCount = document.getElementById('char-count') + if (charCount) { + charCount.textContent = finalContent.length.toString() + } + + console.log('[COSE] LLMAPIS 内容填充成功,长度:', finalContent.length) + } else { + console.error('[COSE] LLMAPIS 未找到内容输入框 #content') + } + } // 通用处理 else { const titleSelectors = ['input[placeholder*="标题"]', 'input[name="title"]', 'textarea[placeholder*="标题"]'] diff --git a/src/inject.js b/src/inject.js index 5868cc3..a84d28e 100644 --- a/src/inject.js +++ b/src/inject.js @@ -93,6 +93,7 @@ { id: 'douyin', name: 'Douyin', icon: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/yvahlyj_upfbvk_zlp/ljhwZthlaukjlkulzlp/pc_creator/favicon_v2_7145ff0.ico', title: '抖音文章', type: 'douyin', url: 'https://creator.douyin.com/creator-micro/content/post/article?default-tab=5&enter_from=publish_page&media_type=article&type=new' }, { id: 'xiaohongshu', name: 'Xiaohongshu', icon: 'https://www.xiaohongshu.com/favicon.ico', title: '小红书', type: 'xiaohongshu', url: 'https://creator.xiaohongshu.com/publish/publish?from=menu&target=article' }, { id: 'elecfans', name: 'Elecfans', icon: 'https://www.elecfans.com/favicon.ico', title: '电子发烧友', type: 'elecfans', url: 'https://www.elecfans.com/d/article/md/' }, + { id: 'llmapis', name: 'LLMAPIS', icon: 'https://llmapis.com/favicon.ico', title: 'LLMAPIS', type: 'llmapis', url: 'https://llmapis.com/garden/post/new' }, ] // 暴露 $cose 全局对象 diff --git a/src/platforms/index.js b/src/platforms/index.js index cac12c8..b8f0961 100644 --- a/src/platforms/index.js +++ b/src/platforms/index.js @@ -29,6 +29,7 @@ import { VolcenginePlatform, VolcengineLoginConfig } from './volcengine.js' import { DouyinPlatform, DouyinLoginConfig } from './douyin.js' import { XiaohongshuPlatform, XiaohongshuLoginConfig } from './xiaohongshu.js' import { ElecfansPlatform, ElecfansLoginConfig } from './elecfans.js' +import { LLMAPIsPlatform, LLMAPIsLoginConfig } from './llmapis.js' // 合并平台配置 const PLATFORMS = [ @@ -62,6 +63,7 @@ const PLATFORMS = [ DouyinPlatform, XiaohongshuPlatform, ElecfansPlatform, + LLMAPIsPlatform, ] // 合并登录检测配置 @@ -96,6 +98,7 @@ const LOGIN_CHECK_CONFIG = { [DouyinPlatform.id]: DouyinLoginConfig, [XiaohongshuPlatform.id]: XiaohongshuLoginConfig, [ElecfansPlatform.id]: ElecfansLoginConfig, + [LLMAPIsPlatform.id]: LLMAPIsLoginConfig, } // 根据 hostname 获取平台填充函数 @@ -130,6 +133,7 @@ function getPlatformFiller(hostname) { if (hostname.includes('creator.douyin.com')) return 'douyin' if (hostname.includes('creator.xiaohongshu.com')) return 'xiaohongshu' if (hostname.includes('elecfans.com')) return 'elecfans' + if (hostname.includes('llmapis.com')) return 'llmapis' return 'generic' } diff --git a/src/platforms/llmapis.js b/src/platforms/llmapis.js new file mode 100644 index 0000000..5a08d43 --- /dev/null +++ b/src/platforms/llmapis.js @@ -0,0 +1,33 @@ +/** + * LLMAPIS 平台配置 + * GitHub: https://github.com/holdno/llmapis + * + * 本站使用 Garden Post (动态) 系统作为内容发布目标 + * 发布页面: /garden/post/new + * + * 填充逻辑在 background.js 的 fillContentOnPage 函数中实现 + */ + +// LLMAPIS 平台配置 +const LLMAPIsPlatform = { + id: 'llmapis', + name: 'LLMAPIS', + icon: 'https://llmapis.com/favicon.ico', + url: 'https://llmapis.com', + publishUrl: 'https://llmapis.com/garden/post/new', + title: 'LLMAPIS', + type: 'llmapis', +} + +// LLMAPIS 登录检测配置 +const LLMAPIsLoginConfig = { + api: 'https://llmapis.com/api/auth/session', + method: 'GET', + checkLogin: (response) => !!response?.session?.user?.id, + getUserInfo: (response) => ({ + username: response?.profile?.username, + avatar: response?.profile?.avatar_url, + }), +} + +export { LLMAPIsPlatform, LLMAPIsLoginConfig }