feat: Add platform adapters for various content publishing platforms
- Implemented Dongchedi adapter for user detection and publishing. - Implemented Jianshu adapter for user detection and publishing. - Implemented Juejin adapter for user detection and publishing. - Implemented Qiehao adapter for user detection and publishing. - Implemented Smzdm adapter for user detection and publishing. - Implemented Sohuhao adapter for user detection and publishing. - Implemented Toutiaohao adapter for user detection and publishing. - Implemented Wangyihao adapter for user detection and publishing. - Implemented Weixin Gzh adapter for user detection and publishing. - Implemented Zol adapter for user detection and publishing. - Added documentation for manual testing of media publishing.
This commit is contained in:
@@ -13,6 +13,23 @@ export interface PublisherRuntimeState {
|
||||
pluginInstallationId: number | null;
|
||||
}
|
||||
|
||||
function normalizePingResponse(ping: PublisherPluginPingResponse | null | undefined): PublisherPluginPingResponse {
|
||||
if (!ping || typeof ping.installed !== "boolean") {
|
||||
return {
|
||||
installed: false,
|
||||
capabilities: [],
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
installed: ping.installed,
|
||||
version: ping.version,
|
||||
capabilities: Array.isArray(ping.capabilities) ? ping.capabilities : [],
|
||||
installation_key: ping.installation_key,
|
||||
plugin_installation_id: ping.plugin_installation_id ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
function detectBrowserName(): string {
|
||||
const ua = navigator.userAgent;
|
||||
if (/Edg\//.test(ua)) {
|
||||
@@ -31,7 +48,7 @@ function detectBrowserName(): string {
|
||||
}
|
||||
|
||||
export async function loadPublisherRuntimeState(): Promise<PublisherRuntimeState> {
|
||||
const ping = await pingPublisherPlugin();
|
||||
const ping = normalizePingResponse(await pingPublisherPlugin());
|
||||
if (!ping.installed || !ping.installation_key) {
|
||||
return {
|
||||
ping,
|
||||
|
||||
Reference in New Issue
Block a user