mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 23:00:19 +03:00
1 parent
1a0ab177db
commit
9dd8412e57
11 files changed
+117
-13
No files matched your search
@@ -33,6 +33,23 @@ services:
|
|||||||
- 8080:8080
|
- 8080:8080
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Filter tools and add home custom content
|
||||||
|
|
||||||
|
You can add custom content in Home page by mounting a `home.custom.md` in `/usr/share/nginx/html`.
|
||||||
|
|
||||||
|
You can filter available tools by mounting `tools-filter.json` in `/usr/share/nginx/html`. It can contains the following filtering regex:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"excludeCategoryFilterRegex": "",
|
||||||
|
"includeCategoryFilterRegex": "",
|
||||||
|
"excludeToolsFilterRegex": "",
|
||||||
|
"includeToolsFilterRegex": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Category matches on category (English) names ; Tools matches on tools path/url.
|
||||||
|
|
||||||
|
See (docker-tools-filter-and-home-content)[https://github.com/sharevb/it-tools]
|
||||||
|
|
||||||
## To build using a custom folder:
|
## To build using a custom folder:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Vendored
+2
@@ -279,6 +279,8 @@ declare module '@vue/runtime-core' {
|
|||||||
NH1: typeof import('naive-ui')['NH1']
|
NH1: typeof import('naive-ui')['NH1']
|
||||||
NH3: typeof import('naive-ui')['NH3']
|
NH3: typeof import('naive-ui')['NH3']
|
||||||
NIcon: typeof import('naive-ui')['NIcon']
|
NIcon: typeof import('naive-ui')['NIcon']
|
||||||
|
NInputGroup: typeof import('naive-ui')['NInputGroup']
|
||||||
|
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
|
||||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||||
NLayout: typeof import('naive-ui')['NLayout']
|
NLayout: typeof import('naive-ui')['NLayout']
|
||||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
services:
|
||||||
|
it-tools:
|
||||||
|
image: sharevb/it-tools:latest
|
||||||
|
pull_policy: always
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./tools-filter.json:/usr/share/nginx/html/tools-filter.json
|
||||||
|
- ./home.custom.md:/usr/share/nginx/html/home.custom.md
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
### Some titles
|
||||||
|
|
||||||
|
Text
|
||||||
|
|
||||||
|
```
|
||||||
|
code
|
||||||
|
```
|
||||||
|
|
||||||
|
And [link](https://sharevb-it-tools.vercel.app/)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"excludeCategoryFilterRegex": "^(Gaming|Maths|Physics)$",
|
||||||
|
"includeCategoryFilterRegex": "",
|
||||||
|
"excludeToolsFilterRegex": "ai-prompt-splitter",
|
||||||
|
"includeToolsFilterRegex": "illuminance-converter"
|
||||||
|
}
|
||||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@@ -3,11 +3,24 @@ import { IconDragDrop, IconFileDescription, IconHeart } from '@tabler/icons-vue'
|
|||||||
import { useHead } from '@vueuse/head';
|
import { useHead } from '@vueuse/head';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import Draggable from 'vuedraggable';
|
import Draggable from 'vuedraggable';
|
||||||
|
import VueMarkdown from 'vue-markdown-render';
|
||||||
import ColoredCard from '../components/ColoredCard.vue';
|
import ColoredCard from '../components/ColoredCard.vue';
|
||||||
import ToolCard from '../components/ToolCard.vue';
|
import ToolCard from '../components/ToolCard.vue';
|
||||||
import { useToolStore } from '@/tools/tools.store';
|
import { useToolStore } from '@/tools/tools.store';
|
||||||
import { config } from '@/config';
|
import { config } from '@/config';
|
||||||
|
|
||||||
|
const base = import.meta.env.BASE_URL ?? '/';
|
||||||
|
const homeCustomMarkdown = computedAsync(async () => {
|
||||||
|
try {
|
||||||
|
const remoteCustomHomeMarkdownResponse = await fetch(`${base}home.custom.md`);
|
||||||
|
if (remoteCustomHomeMarkdownResponse.ok) {
|
||||||
|
return await remoteCustomHomeMarkdownResponse.text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
const toolStore = useToolStore();
|
const toolStore = useToolStore();
|
||||||
|
|
||||||
useHead({ title: 'IT Tools - Handy online tools for developers' });
|
useHead({ title: 'IT Tools - Handy online tools for developers' });
|
||||||
@@ -87,6 +100,10 @@ function onUpdateFavoriteTools() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="homeCustomMarkdown">
|
||||||
|
<VueMarkdown :source="homeCustomMarkdown" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3 class="mb-5px mt-25px font-500 text-neutral-400">
|
<h3 class="mb-5px mt-25px font-500 text-neutral-400">
|
||||||
{{ $t('home.categories.allTools') }}
|
{{ $t('home.categories.allTools') }}
|
||||||
</h3>
|
</h3>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const [coinFlip, refreshCoinFlip] = computedRefreshable(() => ({
|
|||||||
<div>
|
<div>
|
||||||
<Transition name="bounce" mode="out-in">
|
<Transition name="bounce" mode="out-in">
|
||||||
<div :key="coinFlip.dt" flex items-center justify-center>
|
<div :key="coinFlip.dt" flex items-center justify-center>
|
||||||
<div flex items-center justify-center rounded-full outline style="width: 5em; height: 5em" mt-1 mb-1>
|
<div style="width: 5em; height: 5em" mb-1 mt-1 flex items-center justify-center rounded-full outline>
|
||||||
{{ coinFlip.coin }}
|
{{ coinFlip.coin }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+47
-12
@@ -2,25 +2,60 @@ import { type MaybeRef, get, useStorage } from '@vueuse/core';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import type { Tool, ToolCategory, ToolWithCategory } from './tools.types';
|
import type { Tool, ToolCategory, ToolWithCategory, ToolsFilter } from './tools.types';
|
||||||
import { tools as allTools } from './index';
|
import { tools as allTools } from './index';
|
||||||
|
|
||||||
|
const base = import.meta.env.BASE_URL ?? '/';
|
||||||
|
let filterConfig: ToolsFilter = {};
|
||||||
|
try {
|
||||||
|
const remoteConfigResponse = await fetch(`${base}tools-filter.json`);
|
||||||
|
if (remoteConfigResponse.ok) {
|
||||||
|
filterConfig = (await remoteConfigResponse.json()) as ToolsFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {}
|
||||||
|
|
||||||
export const useToolStore = defineStore('tools', () => {
|
export const useToolStore = defineStore('tools', () => {
|
||||||
const favoriteToolsName = useStorage('favoriteToolsName', []) as Ref<string[]>;
|
const favoriteToolsName = useStorage('favoriteToolsName', []) as Ref<string[]>;
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const tools = computed<ToolWithCategory[]>(() => allTools.map((tool) => {
|
const makeRegExp = (regex: string | undefined) => regex ? new RegExp(regex, 'i') : null;
|
||||||
const toolI18nKey = tool.path.replace(/\//g, '');
|
const filters = {
|
||||||
const category = tool.category || 'Development';
|
excludeCategoryFilterRegex: makeRegExp(filterConfig.excludeCategoryFilterRegex),
|
||||||
|
includeCategoryFilterRegex: makeRegExp(filterConfig.includeCategoryFilterRegex),
|
||||||
|
excludeToolsFilterRegex: makeRegExp(filterConfig.excludeToolsFilterRegex),
|
||||||
|
includeToolsFilterRegex: makeRegExp(filterConfig.includeToolsFilterRegex),
|
||||||
|
};
|
||||||
|
|
||||||
return ({
|
const tools = computed<ToolWithCategory[]>(() => allTools
|
||||||
...tool,
|
.filter((tool) => {
|
||||||
path: tool.path,
|
const category = tool.category || 'Development';
|
||||||
name: t(`tools.${toolI18nKey}.title`, tool.name),
|
if (filters.includeToolsFilterRegex?.test(tool.path)) {
|
||||||
description: t(`tools.${toolI18nKey}.description`, tool.description),
|
return true;
|
||||||
category: t(`tools.categories.${category.toLowerCase()}`, category),
|
}
|
||||||
});
|
if (filters.includeCategoryFilterRegex?.test(category)) {
|
||||||
}));
|
return true;
|
||||||
|
}
|
||||||
|
if (filters.excludeToolsFilterRegex?.test(tool.path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (filters.excludeCategoryFilterRegex?.test(category)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.map((tool) => {
|
||||||
|
const toolI18nKey = tool.path.replace(/\//g, '');
|
||||||
|
const category = tool.category || 'Development';
|
||||||
|
|
||||||
|
return ({
|
||||||
|
...tool,
|
||||||
|
path: tool.path,
|
||||||
|
name: t(`tools.${toolI18nKey}.title`, tool.name),
|
||||||
|
description: t(`tools.${toolI18nKey}.description`, tool.description),
|
||||||
|
category: t(`tools.categories.${category.toLowerCase()}`, category),
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
const toolsByCategory = computed<ToolCategory[]>(() => {
|
const toolsByCategory = computed<ToolCategory[]>(() => {
|
||||||
return _.chain(tools.value)
|
return _.chain(tools.value)
|
||||||
|
|||||||
@@ -20,4 +20,11 @@ export interface ToolCategory {
|
|||||||
components: Tool[]
|
components: Tool[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ToolsFilter {
|
||||||
|
excludeCategoryFilterRegex?: string
|
||||||
|
includeCategoryFilterRegex?: string
|
||||||
|
excludeToolsFilterRegex?: string
|
||||||
|
includeToolsFilterRegex?: string
|
||||||
|
}
|
||||||
|
|
||||||
export type ToolWithCategory = Tool & { category: string };
|
export type ToolWithCategory = Tool & { category: string };
|
||||||
Reference in new issue
Block a user