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
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 内容
Expand All @@ -34,36 +34,34 @@ _**C**reate **O**nce **S**ync **E**verywhere_
- 同步的标签页自动归入分组,便于管理
- 微信公众号同步时完整保留渲染样式并自动保存为草稿


## 已支持的平台

> 更多想要添加的平台欢迎提 [Issue](https://github.com/doocs/cose/issues) !
>
> <details>
> <summary>已支持平台速查表(点击展开)</summary>
>
> | 字母 | 平台 |
> |:---:|:---|
> | 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 |
>
> </details>



### 媒体平台

<div align="center">
Expand All @@ -80,11 +78,12 @@ _**C**reate **O**nce **S**ync **E**verywhere_
<img src="https://cdn.simpleicons.org/bilibili" alt="B站专栏" width="60" height="60" />
<img src="https://favicon.im/sspai.com?larger=true" alt="少数派" width="60" height="60" />
<img src="https://cdn.simpleicons.org/x" alt="X(Formerly Twitter) Articles" width="50" height="60" />
<img src="https://llmapis.com/api/badge/doocs/cose" alt="llmapis.com" width="60" />
</div>
</div>


### 博客平台

<div align="center">
<div>
<img src="https://cdn.simpleicons.org/csdn/FC5531" alt="CSDN" width="80" height="60" />
Expand All @@ -100,6 +99,7 @@ _**C**reate **O**nce **S**ync **E**verywhere_
</div>

### 云平台及其开发者社区

<br/>

<div align="center">
Expand All @@ -124,11 +124,14 @@ _**C**reate **O**nce **S**ync **E**verywhere_
</div>
</div>


## 开发者模式测试

1. 克隆或下载本项目
2. 打开 Chrome 浏览器,进入 `chrome://extensions/`
3. 开启右上角的 **开发者模式**
4. 点击 **加载已解压的扩展程序**
5. 选择 `cose` 目录

<a href="https://llmapis.com?source=https%3A%2F%2Fgithub.com%2Fdoocs%2Fcose" target="_blank"><img src="https://llmapis.com/api/badge/doocs/cose" alt="LLMAPIS" width="100" /></a>

_Partnership with [https://llmapis.com](https://llmapis.com) - Discover more awesome tools and resources_
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
31 changes: 31 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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*="标题"]']
Expand Down
1 change: 1 addition & 0 deletions src/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 全局对象
Expand Down
4 changes: 4 additions & 0 deletions src/platforms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -62,6 +63,7 @@ const PLATFORMS = [
DouyinPlatform,
XiaohongshuPlatform,
ElecfansPlatform,
LLMAPIsPlatform,
]

// 合并登录检测配置
Expand Down Expand Up @@ -96,6 +98,7 @@ const LOGIN_CHECK_CONFIG = {
[DouyinPlatform.id]: DouyinLoginConfig,
[XiaohongshuPlatform.id]: XiaohongshuLoginConfig,
[ElecfansPlatform.id]: ElecfansLoginConfig,
[LLMAPIsPlatform.id]: LLMAPIsLoginConfig,
}

// 根据 hostname 获取平台填充函数
Expand Down Expand Up @@ -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'
}

Expand Down
33 changes: 33 additions & 0 deletions src/platforms/llmapis.js
Original file line number Diff line number Diff line change
@@ -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 }