feat: 增加wormhole插件用于文件传输

pull/64/head
moonrailgun 2 years ago
parent 1e67c62626
commit f8765d18c1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -0,0 +1,10 @@
{
"label": "wormhole",
"name": "com.msgbyte.wormhole",
"url": "/plugins/com.msgbyte.wormhole/index.js",
"icon": "/plugins/com.msgbyte.wormhole/assets/icon.webp",
"version": "0.0.0",
"author": "moonrailgun",
"description": "在聊天输入框快捷打开 wormhole 以支持传输文件",
"requireRestart": true
}

@ -0,0 +1,14 @@
{
"name": "@plugins/com.msgbyte.wormhole",
"main": "src/index.tsx",
"version": "0.0.0",
"description": "在聊天输入框快捷打开 wormhole 以支持传输文件",
"private": true,
"scripts": {
"sync:declaration": "tailchat declaration github"
},
"dependencies": {},
"devDependencies": {
"react": "18.2.0"
}
}

@ -0,0 +1,35 @@
import { regChatInputAction } from '@capital/common';
regChatInputAction({
label: 'wormhole',
onClick: () => {
const width = 414;
const height = 736;
const top = (window.screen.height - height) / 2;
const left = (window.screen.width - width) / 2;
window.open(
'https://wormhole.app/',
'wormhole',
buildWindowFeatures({
top,
left,
width,
height,
menubar: false,
toolbar: false,
location: false,
status: false,
resizable: true,
})
);
},
});
function buildWindowFeatures(
options: Record<string, string | number | boolean>
): string {
return Object.entries(options)
.map(([key, val]) => `${key}=${val}`)
.join(',');
}

@ -0,0 +1,7 @@
{
"compilerOptions": {
"esModuleInterop": true,
"jsx": "react",
"importsNotUsedAsValues": "error"
}
}

@ -0,0 +1,326 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/// <reference types="react" />
/**
* Tailchat
*
* : pnpm run plugins:declaration:generate
*/
/**
* Tailchat
*/
declare module '@capital/common' {
export const useGroupPanelParams: any;
/**
*
*/
export const openModal: (
content: React.ReactNode,
props?: {
/**
*
* @default false
*/
closable?: boolean;
/**
*
*/
maskClosable?: boolean;
/**
* modal
*/
onCloseModal?: () => void;
}
) => number;
export const closeModal: any;
export const ModalWrapper: any;
export const useModalContext: any;
export const openConfirmModal: any;
export const openReconfirmModal: any;
export const Loadable: any;
export const getGlobalState: any;
export const getJWTUserInfo: () => Promise<{
_id?: string;
nickname?: string;
email?: string;
avatar?: string;
}>;
export const dataUrlToFile: any;
export const urlSearchStringify: any;
export const urlSearchParse: any;
export const appendUrlSearch: any;
export const getServiceWorkerRegistration: any;
export const getServiceUrl: () => string;
export const getCachedUserInfo: (
userId: string,
refetch?: boolean
) => Promise<{
_id: string;
email: string;
nickname: string;
discriminator: string;
avatar: string | null;
temporary: boolean;
}>;
export const getCachedConverseInfo: any;
/**
*
* @example
* localTrans({'zh-CN': '你好', 'en-US': 'Hello'});
*
* @param trans
*/
export const localTrans: (trans: Record<'zh-CN' | 'en-US', string>) => string;
export const getLanguage: any;
export const sharedEvent: any;
export const useAsync: any;
export const useAsyncFn: any;
export const useAsyncRefresh: any;
export const useAsyncRequest: any;
export const uploadFile: any;
export const showToasts: any;
export const showErrorToasts: any;
export const fetchAvailableServices: any;
export const isValidStr: any;
export const useGroupPanelInfo: any;
export const sendMessage: any;
export const useLocation: any;
export const useNavigate: any;
export const createFastFormSchema: any;
export const fieldSchema: any;
export const useCurrentUserInfo: any;
export const createPluginRequest: (pluginName: string) => {
get: (actionName: string, config?: any) => Promise<any>;
post: (actionName: string, data?: any, config?: any) => Promise<any>;
};
export const postRequest: any;
export const pluginCustomPanel: any;
export const regCustomPanel: any;
export const pluginGroupPanel: any;
export const regGroupPanel: any;
export const messageInterpreter: any;
export const regMessageInterpreter: any;
export const getMessageRender: any;
export const regMessageRender: any;
export const getMessageTextDecorators: any;
export const regMessageTextDecorators: any;
export const ChatInputActionContextProps: any;
export const pluginChatInputActions: any;
export const regChatInputAction: any;
export const regSocketEventListener: (item: {
eventName: string;
eventFn: (...args: any[]) => void;
}) => void;
export const pluginColorScheme: any;
export const regPluginColorScheme: any;
export const pluginInspectServices: any;
export const regInspectService: any;
export const pluginMessageExtraParsers: any;
export const regMessageExtraParser: any;
export const pluginRootRoute: any;
export const regPluginRootRoute: any;
export const pluginPanelActions: any;
export const regPluginPanelAction: any;
export const pluginPermission: any;
export const regPluginPermission: (permission: {
/**
* key,
* , : plugin.com.msgbyte.github.manage
*/
key: string;
/**
*
*/
title: string;
/**
*
*/
desc: string;
/**
*
*/
default: boolean;
/**
*
*/
required?: string[];
}) => void;
export const useGroupIdContext: () => string;
export const useGroupPanelContext: () => {
groupId: string;
panelId: string;
} | null;
export const useSocketContext: any;
}
/**
* Tailchat
*/
declare module '@capital/component' {
export const Button: any;
export const Checkbox: any;
export const Input: any;
export const Divider: any;
export const Space: any;
export const Menu: any;
export const Table: any;
export const Switch: any;
export const Tooltip: any;
/**
* @link https://ant.design/components/notification-cn/
*/
export const notification: any;
export const Empty: any;
export const Avatar: any;
export const SensitiveText: React.FC<{ className?: string; text: string }>;
export const TextArea: any;
export const Image: any;
export const Icon: React.FC<{ icon: string } & React.SVGProps<SVGSVGElement>>;
export const IconBtn: React.FC<{
icon: string;
iconClassName?: string;
shape?: 'circle' | 'square';
title?: string;
}>;
export const PillTabs: any;
export const PillTabPane: any;
export const LoadingSpinner: any;
export const WebFastForm: any;
export const WebMetaForm: any;
export const createMetaFormSchema: any;
export const metaFormFieldSchema: any;
export const FullModalField: any;
export const DefaultFullModalInputEditorRender: any;
export const DefaultFullModalTextAreaEditorRender: any;
export const openModal: any;
export const closeModal: any;
export const ModalWrapper: any;
export const useModalContext: any;
export const openConfirmModal: any;
export const openReconfirmModal: any;
export const Loading: any;
export const SidebarView: any;
export const GroupPanelSelector: any;
export const Emoji: any;
export const PortalAdd: any;
export const PortalRemove: any;
export const ErrorBoundary: any;
export const UserName: React.FC<{
userId: string;
className?: string;
}>;
export const Markdown: any;
}

@ -103,5 +103,15 @@
"author": "moonrailgun",
"description": "为用户信息增加地理位置记录",
"requireRestart": true
},
{
"label": "wormhole",
"name": "com.msgbyte.wormhole",
"url": "/plugins/com.msgbyte.wormhole/index.js",
"icon": "/plugins/com.msgbyte.wormhole/assets/icon.webp",
"version": "0.0.0",
"author": "moonrailgun",
"description": "在聊天输入框快捷打开 wormhole 以支持传输文件",
"requireRestart": true
}
]

@ -702,6 +702,12 @@ importers:
devDependencies:
react: 18.2.0
client/web/plugins/com.msgbyte.wormhole:
specifiers:
react: 18.2.0
devDependencies:
react: 18.2.0
server:
specifiers:
'@babel/helper-compilation-targets': ^7.18.2
@ -3908,24 +3914,6 @@ packages:
transitivePeerDependencies:
- supports-color
/@babel/traverse/7.18.13_supports-color@5.5.0:
resolution: {integrity: sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/generator': 7.18.13
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-function-name': 7.18.9
'@babel/helper-hoist-variables': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/parser': 7.18.13
'@babel/types': 7.18.13
debug: 4.3.4_supports-color@5.5.0
globals: 11.12.0
transitivePeerDependencies:
- supports-color
dev: false
/@babel/traverse/7.20.5:
resolution: {integrity: sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==}
engines: {node: '>=6.9.0'}
@ -13482,7 +13470,7 @@ packages:
babel-plugin-syntax-jsx: 6.18.0
lodash: 4.17.21
picomatch: 2.3.1
styled-components: 5.3.6_7i5myeigehqah43i5u7wbekgba
styled-components: 5.3.6_react@18.2.0
/babel-plugin-syntax-jsx/6.18.0:
resolution: {integrity: sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==}
@ -18965,7 +18953,7 @@ packages:
peerDependencies:
webpack: ^4.0.0 || ^5.0.0
dependencies:
loader-utils: 2.0.2
loader-utils: 2.0.4
schema-utils: 3.1.1
webpack: 5.75.0_webpack-cli@4.10.0
dev: true
@ -20852,6 +20840,7 @@ packages:
postcss: ^8.1.0
dependencies:
postcss: 8.4.20
dev: true
/idb-keyval/5.1.5:
resolution: {integrity: sha512-J1utxYWQokYjy01LvDQ7WmiAtZCGUSkVi9EIBfUSyLOr/BesnMIxNGASTh9A1LzeISSjSqEPsfFdTss7EE7ofQ==}
@ -22135,7 +22124,7 @@ packages:
pretty-format: 27.5.1
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.9.1_nzafxra4mdyuer2ejmql6rdadq
ts-node: 10.9.1_k2dsl7zculo2nmh5s33pladmoa
transitivePeerDependencies:
- bufferutil
- canvas
@ -26989,6 +26978,7 @@ packages:
postcss: ^8.1.0
dependencies:
postcss: 8.4.20
dev: true
/postcss-modules-local-by-default/3.0.3:
resolution: {integrity: sha512-e3xDq+LotiGesympRlKNgaJ0PCzoUIdpH0dj47iWAui/kyTgh3CiAr1qP54uodmJhl6p9rN6BoNcdEDVJx9RDw==}
@ -27021,6 +27011,7 @@ packages:
postcss: 8.4.20
postcss-selector-parser: 6.0.11
postcss-value-parser: 4.2.0
dev: true
/postcss-modules-scope/2.2.0:
resolution: {integrity: sha512-YyEgsTMRpNd+HmyC7H/mh3y+MeFWevy7V1evVhJWewmMbjDHIbZbOXICC2y+m1xI1UVfIT1HMW/O04Hxyu9oXQ==}
@ -27047,6 +27038,7 @@ packages:
dependencies:
postcss: 8.4.20
postcss-selector-parser: 6.0.11
dev: true
/postcss-modules-values/3.0.0:
resolution: {integrity: sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg==}
@ -27072,6 +27064,7 @@ packages:
dependencies:
icss-utils: 5.1.0_postcss@8.4.20
postcss: 8.4.20
dev: true
/postcss-nested/5.0.6_postcss@8.4.17:
resolution: {integrity: sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA==}
@ -31040,23 +31033,23 @@ packages:
dependencies:
'@rollup/pluginutils': 4.2.1
'@types/cssnano': 4.0.1
cosmiconfig: 7.1.0
cosmiconfig: 7.0.1
cssnano: 4.1.11
fs-extra: 9.1.0
icss-utils: 5.1.0_postcss@8.4.20
icss-utils: 5.1.0_postcss@8.4.17
mime-types: 2.1.35
p-queue: 6.6.2
postcss: 8.4.20
postcss-modules-extract-imports: 3.0.0_postcss@8.4.20
postcss-modules-local-by-default: 4.0.0_postcss@8.4.20
postcss-modules-scope: 3.0.0_postcss@8.4.20
postcss-modules-values: 4.0.0_postcss@8.4.20
postcss: 8.4.17
postcss-modules-extract-imports: 3.0.0_postcss@8.4.17
postcss-modules-local-by-default: 4.0.0_postcss@8.4.17
postcss-modules-scope: 3.0.0_postcss@8.4.17
postcss-modules-values: 4.0.0_postcss@8.4.17
postcss-value-parser: 4.2.0
query-string: 6.14.1
resolve: 1.22.1
rollup: 2.79.1
source-map: 0.7.4
tslib: 2.4.1
tslib: 2.4.0
/rollup-plugin-terser/6.1.0_rollup@2.78.1:
resolution: {integrity: sha512-4fB3M9nuoWxrwm39habpd4hvrbrde2W2GG4zEGPQg1YITNkM3Tqur5jSuXlWNzbv/2aMLJ+dZJaySc3GCD8oDw==}
@ -32583,7 +32576,7 @@ packages:
react-is: '>= 16.8.0'
dependencies:
'@babel/helper-module-imports': 7.18.6
'@babel/traverse': 7.18.13_supports-color@5.5.0
'@babel/traverse': 7.20.5_supports-color@5.5.0
'@emotion/is-prop-valid': 1.2.0
'@emotion/stylis': 0.8.5
'@emotion/unitless': 0.7.5
@ -32595,6 +32588,7 @@ packages:
react-is: 18.2.0
shallowequal: 1.1.0
supports-color: 5.5.0
dev: false
/styled-components/5.3.6_mdz3marskokvq6744hhidi3r5a:
resolution: {integrity: sha512-hGTZquGAaTqhGWldX7hhfzjnIYBZ0IXQXkCYdvF1Sq3DsUaLx6+NTHC5Jj1ooM2F68sBiVz3lvhfwQs/S3l6qg==}
@ -32606,7 +32600,7 @@ packages:
react-is: '>= 16.8.0'
dependencies:
'@babel/helper-module-imports': 7.18.6
'@babel/traverse': 7.18.13_supports-color@5.5.0
'@babel/traverse': 7.20.5_supports-color@5.5.0
'@emotion/is-prop-valid': 1.2.0
'@emotion/stylis': 0.8.5
'@emotion/unitless': 0.7.5
@ -32640,7 +32634,6 @@ packages:
react: 18.2.0
shallowequal: 1.1.0
supports-color: 5.5.0
dev: true
/styled-system/5.1.5:
resolution: {integrity: sha512-7VoD0o2R3RKzOzPK0jYrVnS8iJdfkKsQJNiLRDjikOpQVqQHns/DXWaPZOH4tIKkhAT7I6wIsy9FWTWh2X3q+A==}
@ -34618,7 +34611,7 @@ packages:
optional: true
dependencies:
file-loader: 6.2.0_webpack@5.75.0
loader-utils: 2.0.2
loader-utils: 2.0.4
mime-types: 2.1.35
schema-utils: 3.1.1
webpack: 5.75.0_webpack-cli@4.10.0

@ -1,4 +1,4 @@
import { TcContext } from 'tailchat-server-sdk';
import type { TcContext } from 'tailchat-server-sdk';
import { TcService, TcDbService } from 'tailchat-server-sdk';
import type { AgoraDocument, AgoraModel } from '../models/agora';
import { RtcTokenBuilder, Role as RtcRole } from './utils/RtcTokenBuilder2';

Loading…
Cancel
Save