mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 15:33:57 +00:00
icons
This commit is contained in:
@@ -99,6 +99,7 @@ module.exports = {
|
||||
|
||||
const res = [];
|
||||
for (const packageName of _.union(files1, files2)) {
|
||||
if (!/^dbgate-plugin-.*$/.test(packageName)) continue;
|
||||
const isPackaged = files1.includes(packageName);
|
||||
const manifest = await fs
|
||||
.readFile(path.join(isPackaged ? packagedPluginsDir() : pluginsdir(), packageName, 'package.json'), {
|
||||
|
||||
@@ -44,7 +44,7 @@ function packagedPluginsDir() {
|
||||
if (_isRunOnSource()) {
|
||||
return path.resolve(__dirname, '../../../../plugins');
|
||||
}
|
||||
return path.resolve(__dirname, '../plugins');
|
||||
return path.resolve(__dirname, '../../plugins/dist');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
// import React from 'react';
|
||||
// import styled from 'styled-components';
|
||||
// import useTheme from '../theme/useTheme';
|
||||
// import { useSetOpenedTabs } from '../utility/globalState';
|
||||
// import { extractPluginIcon, extractPluginAuthor } from '../plugins/manifestExtractors';
|
||||
// import useOpenNewTab from '../utility/useOpenNewTab';
|
||||
|
||||
// const Wrapper = styled.div`
|
||||
// margin: 1px 3px 10px 5px;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// &:hover {
|
||||
// background-color: ${props => props.theme.left_background_blue[1]};
|
||||
// }
|
||||
// `;
|
||||
|
||||
// const Texts = styled.div`
|
||||
// margin-left: 10px;
|
||||
// `;
|
||||
|
||||
// const Name = styled.div`
|
||||
// font-weight: bold;
|
||||
// `;
|
||||
|
||||
// const Line = styled.div`
|
||||
// display: flex;
|
||||
// `;
|
||||
|
||||
// const Icon = styled.img`
|
||||
// width: 50px;
|
||||
// height: 50px;
|
||||
// `;
|
||||
|
||||
// const Description = styled.div`
|
||||
// font-style: italic;
|
||||
// `;
|
||||
|
||||
// const Author = styled.div`
|
||||
// font-weight: bold;
|
||||
// `;
|
||||
|
||||
// const Version = styled.div`
|
||||
// margin-left: 5px;
|
||||
// `;
|
||||
|
||||
// function openPlugin(openNewTab, packageManifest) {
|
||||
// openNewTab({
|
||||
// title: packageManifest.name,
|
||||
// icon: 'icon plugin',
|
||||
// tabComponent: 'PluginTab',
|
||||
// props: {
|
||||
// packageName: packageManifest.name,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
|
||||
// function PluginsListItem({ packageManifest }) {
|
||||
// const openNewTab = useOpenNewTab();
|
||||
// const theme = useTheme();
|
||||
// return (
|
||||
// <Wrapper onClick={() => openPlugin(openNewTab, packageManifest)} theme={theme}>
|
||||
// <Icon src={extractPluginIcon(packageManifest)} />
|
||||
// <Texts>
|
||||
// <Line>
|
||||
// <Name>{packageManifest.name}</Name>
|
||||
// <Version>{packageManifest.version}</Version>
|
||||
// </Line>
|
||||
// <Line>
|
||||
// <Description>{packageManifest.description}</Description>
|
||||
// </Line>
|
||||
// <Line>
|
||||
// <Author>{extractPluginAuthor(packageManifest)}</Author>
|
||||
// </Line>
|
||||
// </Texts>
|
||||
// </Wrapper>
|
||||
// );
|
||||
// }
|
||||
|
||||
// export default function PluginsList({ plugins }) {
|
||||
// return (
|
||||
// <>
|
||||
// {plugins.map(packageManifest => (
|
||||
// <PluginsListItem packageManifest={packageManifest} key={packageManifest.name} />
|
||||
// ))}
|
||||
// </>
|
||||
// );
|
||||
// }
|
||||
@@ -11,6 +11,10 @@ export function extractPluginIcon(packageManifest) {
|
||||
if (match) {
|
||||
return `https://raw.githubusercontent.com/${match[1]}/${match[2]}/master/icon.svg`;
|
||||
}
|
||||
|
||||
if (tested == 'https://dbgate.org') {
|
||||
return `https://github.com/dbgate/dbgate/raw/master/plugins/${packageManifest.name}/icon.svg`;
|
||||
}
|
||||
}
|
||||
return 'unknown.svg';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user