fontastic 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.eslintrc.json +54 -0
- package/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/dependabot.yml +6 -0
- package/.github/pull_request_template.md +21 -0
- package/.github/stale.yml +17 -0
- package/.github/workflows/macos.yml +58 -0
- package/.github/workflows/ubuntu.yml +70 -0
- package/.github/workflows/windows.yml +64 -0
- package/.node-version +1 -0
- package/.vscode/launch.json +46 -0
- package/.vscode/tasks.json +49 -0
- package/CODE_OF_CONDUCT.md +45 -0
- package/CONTRIBUTING.md +72 -0
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/_config.yml +1 -0
- package/angular.json +194 -0
- package/angular.webpack.js +32 -0
- package/app/Application.js +40 -0
- package/app/Application.ts +38 -0
- package/app/config/alert.ts +32 -0
- package/app/config/database.js +203 -0
- package/app/config/database.ts +202 -0
- package/app/config/index.js +20 -0
- package/app/config/index.ts +3 -0
- package/app/config/mimes.js +49 -0
- package/app/config/mimes.ts +54 -0
- package/app/config/system.js +497 -0
- package/app/config/system.ts +498 -0
- package/app/config/themes.ts +38 -0
- package/app/core/AppLogger.js +31 -0
- package/app/core/AppLogger.ts +38 -0
- package/app/core/ConfigManager.js +114 -0
- package/app/core/ConfigManager.ts +137 -0
- package/app/core/ConnectionManager.js +83 -0
- package/app/core/ConnectionManager.ts +95 -0
- package/app/core/FontCatalog.js +51 -0
- package/app/core/FontCatalog.ts +42 -0
- package/app/core/FontFinder.js +86 -0
- package/app/core/FontFinder.ts +96 -0
- package/app/core/FontInstaller.js +67 -0
- package/app/core/FontInstaller.ts +63 -0
- package/app/core/FontManager.js +165 -0
- package/app/core/FontManager.ts +172 -0
- package/app/core/FontObject.js +54 -0
- package/app/core/FontObject.ts +62 -0
- package/app/core/MessageHandler.js +272 -0
- package/app/core/MessageHandler.ts +337 -0
- package/app/core/SystemManager.js +140 -0
- package/app/core/SystemManager.ts +171 -0
- package/app/core/menu/Example.ts +280 -0
- package/app/core/menu/MenuBuilder.js +45 -0
- package/app/core/menu/MenuBuilder.ts +53 -0
- package/app/core/menu/templates/DarwinTemplate.js +127 -0
- package/app/core/menu/templates/DarwinTemplate.ts +142 -0
- package/app/core/menu/templates/SystemTemplate.js +124 -0
- package/app/core/menu/templates/SystemTemplate.ts +139 -0
- package/app/database/entity/Collection.schema.js +99 -0
- package/app/database/entity/Collection.schema.ts +68 -0
- package/app/database/entity/Logger.schema.js +50 -0
- package/app/database/entity/Logger.schema.ts +26 -0
- package/app/database/entity/Store.schema.js +165 -0
- package/app/database/entity/Store.schema.ts +116 -0
- package/app/database/entity/index.js +20 -0
- package/app/database/entity/index.ts +3 -0
- package/app/database/repository/Collection.repository.js +181 -0
- package/app/database/repository/Collection.repository.ts +190 -0
- package/app/database/repository/Logger.repository.js +25 -0
- package/app/database/repository/Logger.repository.ts +11 -0
- package/app/database/repository/Store.repository.js +328 -0
- package/app/database/repository/Store.repository.ts +358 -0
- package/app/database/repository/User.repository.js +12 -0
- package/app/database/repository/User.repository.ts +8 -0
- package/app/database/repository/index.js +20 -0
- package/app/database/repository/index.ts +3 -0
- package/app/enums/ChannelType.js +62 -0
- package/app/enums/ChannelType.ts +65 -0
- package/app/enums/StorageType.js +19 -0
- package/app/enums/index.js +19 -0
- package/app/enums/index.ts +2 -0
- package/app/enums/storageType.ts +14 -0
- package/app/helpers/command.js +28 -0
- package/app/helpers/command.ts +20 -0
- package/app/helpers/random.js +16 -0
- package/app/helpers/random.ts +12 -0
- package/app/main.js +82 -0
- package/app/main.ts +94 -0
- package/app/package-lock.json +2649 -0
- package/app/package.json +35 -0
- package/app/types/AppAlert.js +3 -0
- package/app/types/AppAlert.ts +8 -0
- package/app/types/AuthUser.js +7 -0
- package/app/types/AuthUser.ts +5 -0
- package/app/types/Breadcrumb.js +3 -0
- package/app/types/Breadcrumb.ts +5 -0
- package/app/types/ImportOptions.js +7 -0
- package/app/types/ImportOptions.ts +3 -0
- package/app/types/QueryOptions.js +3 -0
- package/app/types/QueryOptions.ts +12 -0
- package/app/types/SystemConfig.js +3 -0
- package/app/types/SystemConfig.ts +132 -0
- package/app/types/SystemStats.js +3 -0
- package/app/types/SystemStats.ts +7 -0
- package/app/types/SystemTheme.js +3 -0
- package/app/types/SystemTheme.ts +5 -0
- package/app/types/index.js +25 -0
- package/app/types/index.ts +8 -0
- package/docs/logo.png +0 -0
- package/docs/screenshots/readme.md +7 -0
- package/docs/screenshots/screen-grab1.png +0 -0
- package/docs/screenshots/screen-grab2.png +0 -0
- package/docs/screenshots/screen-grab3.png +0 -0
- package/e2e/main.spec.ts +59 -0
- package/e2e/playwright.config.ts +19 -0
- package/e2e/tsconfig.e2e.json +13 -0
- package/electron-builder.json +71 -0
- package/package.json +121 -0
- package/src/app/app-routing.module.ts +15 -0
- package/src/app/app.component.html +1 -0
- package/src/app/app.component.scss +0 -0
- package/src/app/app.component.spec.ts.dist +33 -0
- package/src/app/app.component.ts +37 -0
- package/src/app/app.module.ts +63 -0
- package/src/app/core/core.module.ts +11 -0
- package/src/app/core/model/AuthUserModel.ts +7 -0
- package/src/app/core/model/CustomThemeModel.ts +7 -0
- package/src/app/core/model/DbConnectionModel.ts +16 -0
- package/src/app/core/model/ImportOptionsModel.ts +5 -0
- package/src/app/core/model/LatestNewsModel.ts +7 -0
- package/src/app/core/model/SearchFormModel.ts +10 -0
- package/src/app/core/model/index.ts +6 -0
- package/src/app/core/services/alert/alert.service.spec.ts +22 -0
- package/src/app/core/services/alert/alert.service.ts +71 -0
- package/src/app/core/services/auth/auth.service.ts +30 -0
- package/src/app/core/services/boot/boot.service.ts +33 -0
- package/src/app/core/services/breadcrumb/breadcrumb.service.spec.ts +22 -0
- package/src/app/core/services/breadcrumb/breadcrumb.service.ts +30 -0
- package/src/app/core/services/config/config.service.ts +63 -0
- package/src/app/core/services/database/database.service.ts +286 -0
- package/src/app/core/services/electron/electron.service.spec.ts +12 -0
- package/src/app/core/services/electron/electron.service.ts +62 -0
- package/src/app/core/services/font/font.service.ts +79 -0
- package/src/app/core/services/gravatar/gravatar.service.spec.ts +16 -0
- package/src/app/core/services/gravatar/gravatar.service.ts +18 -0
- package/src/app/core/services/index.ts +14 -0
- package/src/app/core/services/message/message.service.ts +289 -0
- package/src/app/core/services/modal/modal.service.spec.ts +16 -0
- package/src/app/core/services/modal/modal.service.ts +34 -0
- package/src/app/core/services/news/news.service.ts +94 -0
- package/src/app/core/services/presentation/presentation.service.ts +341 -0
- package/src/app/core/services/utils/utils.service.spec.ts +12 -0
- package/src/app/core/services/utils/utils.service.ts +144 -0
- package/src/app/layout/aside/aside.component.html +9 -0
- package/src/app/layout/aside/aside.component.scss +1 -0
- package/src/app/layout/aside/aside.component.ts +26 -0
- package/src/app/layout/footer/footer.component.html +11 -0
- package/src/app/layout/footer/footer.component.scss +27 -0
- package/src/app/layout/footer/footer.component.ts +32 -0
- package/src/app/layout/header/header.component.html +35 -0
- package/src/app/layout/header/header.component.scss +60 -0
- package/src/app/layout/header/header.component.ts +229 -0
- package/src/app/layout/layout.component.html +14 -0
- package/src/app/layout/layout.component.scss +119 -0
- package/src/app/layout/layout.component.ts +23 -0
- package/src/app/layout/layout.module.ts +32 -0
- package/src/app/layout/layout.service.ts +13 -0
- package/src/app/layout/navigation/navigation.component.html +142 -0
- package/src/app/layout/navigation/navigation.component.scss +0 -0
- package/src/app/layout/navigation/navigation.component.ts +302 -0
- package/src/app/pages/main/grid/grid.component.html +160 -0
- package/src/app/pages/main/grid/grid.component.scss +3 -0
- package/src/app/pages/main/grid/grid.component.ts +98 -0
- package/src/app/pages/main/inspect/inspect.component.html +7 -0
- package/src/app/pages/main/inspect/inspect.component.scss +3 -0
- package/src/app/pages/main/inspect/inspect.component.ts +66 -0
- package/src/app/pages/main/main-routing.module.ts +30 -0
- package/src/app/pages/main/main.component.html +6 -0
- package/src/app/pages/main/main.component.scss +191 -0
- package/src/app/pages/main/main.component.ts +35 -0
- package/src/app/pages/main/main.module.ts +28 -0
- package/src/app/pages/main/preview/preview.component.html +46 -0
- package/src/app/pages/main/preview/preview.component.scss +0 -0
- package/src/app/pages/main/preview/preview.component.ts +239 -0
- package/src/app/pages/main/toolbar/toolbar.component.html +78 -0
- package/src/app/pages/main/toolbar/toolbar.component.scss +3 -0
- package/src/app/pages/main/toolbar/toolbar.component.ts +132 -0
- package/src/app/shared/components/alert/alert.component.html +9 -0
- package/src/app/shared/components/alert/alert.component.scss +0 -0
- package/src/app/shared/components/alert/alert.component.ts +37 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.html +14 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.scss +0 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.ts +36 -0
- package/src/app/shared/components/button/button.component.html +3 -0
- package/src/app/shared/components/button/button.component.scss +2 -0
- package/src/app/shared/components/button/button.component.ts +22 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.html +41 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.scss +0 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.ts +68 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.html +1 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.scss +0 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.ts +15 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.html +40 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.scss +0 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.ts +71 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.html +40 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.scss +1 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.ts +165 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.html +23 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.scss +0 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.ts +228 -0
- package/src/app/shared/components/index.ts +16 -0
- package/src/app/shared/components/loading/loading.component.html +1 -0
- package/src/app/shared/components/loading/loading.component.scss +0 -0
- package/src/app/shared/components/loading/loading.component.ts +26 -0
- package/src/app/shared/components/modal/modal.component.html +31 -0
- package/src/app/shared/components/modal/modal.component.scss +0 -0
- package/src/app/shared/components/modal/modal.component.ts +51 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.html +3 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.scss +0 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.ts +12 -0
- package/src/app/shared/components/paginator/paginator.component.html +21 -0
- package/src/app/shared/components/paginator/paginator.component.scss +3 -0
- package/src/app/shared/components/paginator/paginator.component.ts +133 -0
- package/src/app/shared/components/pairing/pairing.component.html +20 -0
- package/src/app/shared/components/pairing/pairing.component.scss +0 -0
- package/src/app/shared/components/pairing/pairing.component.ts +33 -0
- package/src/app/shared/components/search/search.component.html +54 -0
- package/src/app/shared/components/search/search.component.scss +10 -0
- package/src/app/shared/components/search/search.component.ts +77 -0
- package/src/app/shared/components/settings/database/database.component.html +151 -0
- package/src/app/shared/components/settings/database/database.component.scss +0 -0
- package/src/app/shared/components/settings/database/database.component.ts +145 -0
- package/src/app/shared/components/settings/general/general.component.html +170 -0
- package/src/app/shared/components/settings/general/general.component.scss +0 -0
- package/src/app/shared/components/settings/general/general.component.ts +150 -0
- package/src/app/shared/components/settings/logs/logs.component.html +44 -0
- package/src/app/shared/components/settings/logs/logs.component.scss +0 -0
- package/src/app/shared/components/settings/logs/logs.component.ts +37 -0
- package/src/app/shared/components/settings/news/news.component.html +41 -0
- package/src/app/shared/components/settings/news/news.component.scss +0 -0
- package/src/app/shared/components/settings/news/news.component.ts +52 -0
- package/src/app/shared/components/settings/settings.component.html +46 -0
- package/src/app/shared/components/settings/settings.component.scss +0 -0
- package/src/app/shared/components/settings/settings.component.ts +23 -0
- package/src/app/shared/components/settings/system/system.component.html +30 -0
- package/src/app/shared/components/settings/system/system.component.scss +0 -0
- package/src/app/shared/components/settings/system/system.component.ts +43 -0
- package/src/app/shared/components/settings/theme/theme.component.html +22 -0
- package/src/app/shared/components/settings/theme/theme.component.scss +0 -0
- package/src/app/shared/components/settings/theme/theme.component.ts +50 -0
- package/src/app/shared/components/spinner/spinner.component.html +1 -0
- package/src/app/shared/components/spinner/spinner.component.scss +0 -0
- package/src/app/shared/components/spinner/spinner.component.ts +26 -0
- package/src/app/shared/components/store/store.component.html +22 -0
- package/src/app/shared/components/store/store.component.scss +10 -0
- package/src/app/shared/components/store/store.component.ts +58 -0
- package/src/app/shared/components/tables/tables.component.html +47 -0
- package/src/app/shared/components/tables/tables.component.scss +10 -0
- package/src/app/shared/components/tables/tables.component.ts +81 -0
- package/src/app/shared/components/typescale/typescale.component.html +53 -0
- package/src/app/shared/components/typescale/typescale.component.scss +0 -0
- package/src/app/shared/components/typescale/typescale.component.ts +168 -0
- package/src/app/shared/directives/gravatar/gravatar.directive.ts +29 -0
- package/src/app/shared/directives/index.ts +2 -0
- package/src/app/shared/directives/webview/webview.directive.ts +8 -0
- package/src/app/shared/pipes/installable.pipe.ts +10 -0
- package/src/app/shared/pipes/prettybytes.pipe.ts +10 -0
- package/src/app/shared/pipes/safehtml.pipe.ts +10 -0
- package/src/app/shared/shared.module.ts +92 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/fonts/fa/fa-brands-400.eot +0 -0
- package/src/assets/fonts/fa/fa-brands-400.svg +3535 -0
- package/src/assets/fonts/fa/fa-brands-400.ttf +0 -0
- package/src/assets/fonts/fa/fa-brands-400.woff +0 -0
- package/src/assets/fonts/fa/fa-brands-400.woff2 +0 -0
- package/src/assets/fonts/fa/fa-regular-400.eot +0 -0
- package/src/assets/fonts/fa/fa-regular-400.svg +803 -0
- package/src/assets/fonts/fa/fa-regular-400.ttf +0 -0
- package/src/assets/fonts/fa/fa-regular-400.woff +0 -0
- package/src/assets/fonts/fa/fa-regular-400.woff2 +0 -0
- package/src/assets/fonts/fa/fa-solid-900.eot +0 -0
- package/src/assets/fonts/fa/fa-solid-900.svg +4700 -0
- package/src/assets/fonts/fa/fa-solid-900.ttf +0 -0
- package/src/assets/fonts/fa/fa-solid-900.woff +0 -0
- package/src/assets/fonts/fa/fa-solid-900.woff2 +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.eot +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.ijmap +1 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.svg +2373 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.ttf +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.woff +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.woff2 +0 -0
- package/src/assets/fonts/md/README.md +9 -0
- package/src/assets/fonts/md/codepoints +932 -0
- package/src/assets/fonts/md/material-icons.css +36 -0
- package/src/assets/fonts/octicon/octicon.eot +0 -0
- package/src/assets/fonts/octicon/octicon.svg +378 -0
- package/src/assets/fonts/octicon/octicon.ttf +0 -0
- package/src/assets/fonts/octicon/octicon.woff +0 -0
- package/src/assets/fonts/octicon/octicon.woff2 +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.svg +607 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.woff +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.svg +607 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.woff +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.svg +635 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.woff +0 -0
- package/src/assets/i18n/en.json +12 -0
- package/src/assets/icons/android-chrome-192x192.png +0 -0
- package/src/assets/icons/android-chrome-512x512.png +0 -0
- package/src/assets/icons/apple-touch-icon.png +0 -0
- package/src/assets/icons/favicon-16x16.png +0 -0
- package/src/assets/icons/favicon-32x32.png +0 -0
- package/src/assets/icons/favicon.ico +0 -0
- package/src/assets/icons/site.webmanifest +1 -0
- package/src/assets/images/electron.bmp +0 -0
- package/src/bin/activator +0 -0
- package/src/bin/activator.exe +0 -0
- package/src/environments/environment.dev.ts +4 -0
- package/src/environments/environment.prod.ts +4 -0
- package/src/environments/environment.ts +4 -0
- package/src/environments/environment.web.prod.ts +4 -0
- package/src/environments/environment.web.ts +4 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +55 -0
- package/src/karma.conf.js +50 -0
- package/src/main.ts +15 -0
- package/src/polyfills-test.ts +1 -0
- package/src/polyfills.ts +53 -0
- package/src/styles/base/loading.scss +87 -0
- package/src/styles/base/reset.scss +408 -0
- package/src/styles/components/alert.scss +54 -0
- package/src/styles/components/buttons.scss +93 -0
- package/src/styles/components/forms.scss +96 -0
- package/src/styles/components/inputs.scss +113 -0
- package/src/styles/components/modal.scss +52 -0
- package/src/styles/components/paginator.scss +108 -0
- package/src/styles/components/scrollbox.scss +71 -0
- package/src/styles/components/spinner.scss +11 -0
- package/src/styles/components/tables.scss +42 -0
- package/src/styles/components/tabs.scss +44 -0
- package/src/styles/components/toolbar.scss +130 -0
- package/src/styles/fonts/md.scss +54 -0
- package/src/styles/fonts/octicons.scss +1351 -0
- package/src/styles/fonts/roboto.scss +32 -0
- package/src/styles/themes/dashboard.scss +294 -0
- package/src/styles/themes/euphoria.scss +283 -0
- package/src/styles/themes/mellow.scss +280 -0
- package/src/styles/themes/midnight.scss +283 -0
- package/src/styles/themes/passion.scss +280 -0
- package/src/styles/themes/swiss.scss +283 -0
- package/src/styles/tools/_functions.scss +5 -0
- package/src/styles/tools/_mixins.scss +159 -0
- package/src/styles/tools/_placeholders.scss +17 -0
- package/src/styles/tools/_variables.scss +67 -0
- package/src/styles.scss +37 -0
- package/src/test.ts +22 -0
- package/src/tsconfig.app.json +20 -0
- package/src/tsconfig.spec.json +23 -0
- package/src/typings.d.ts +9 -0
- package/tailwind.config.js +67 -0
- package/tsconfig.json +42 -0
- package/tsconfig.serve.json +27 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import ConnectionManager from "./ConnectionManager";
|
|
2
|
+
import FontObject from "./FontObject";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { installable } from "../config/mimes";
|
|
6
|
+
|
|
7
|
+
const prettyBytes = require("pretty-bytes");
|
|
8
|
+
const mime = require("mime");
|
|
9
|
+
|
|
10
|
+
// https://stackoverflow.com/questions/10049557/reading-all-files-in-a-directory-store-them-in-objects-and-send-the-object
|
|
11
|
+
|
|
12
|
+
export default class FileSystem {
|
|
13
|
+
|
|
14
|
+
connectionManager: ConnectionManager;
|
|
15
|
+
|
|
16
|
+
counter: number = 0;
|
|
17
|
+
errors: any[] = [];
|
|
18
|
+
found: any[] = [];
|
|
19
|
+
|
|
20
|
+
constructor(connectionManager: ConnectionManager) {
|
|
21
|
+
this.connectionManager = connectionManager;
|
|
22
|
+
|
|
23
|
+
this.counter = 0;
|
|
24
|
+
this.errors = [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setCounter(count: number): void {
|
|
28
|
+
this.counter = count;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getCounter(): number {
|
|
32
|
+
return this.counter;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
scanFolders(dir: any, options: any, done: any) {
|
|
36
|
+
fs.readdir(dir, (err: any, list: any) => {
|
|
37
|
+
if (err) return done(err);
|
|
38
|
+
let i = 0;
|
|
39
|
+
let next = () => {
|
|
40
|
+
let file = list[i++];
|
|
41
|
+
if (!file) return done(null, this);
|
|
42
|
+
let fp = path.resolve(dir, file);
|
|
43
|
+
fs.stat(fp, async (err: any, stat: any) => {
|
|
44
|
+
if (stat && stat.isDirectory()) {
|
|
45
|
+
this.scanFolders(fp, options, (err: any, res: any) => next());
|
|
46
|
+
} else {
|
|
47
|
+
this.fontInstall(fp, stat, options);
|
|
48
|
+
next();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
next();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
scanFiles(files: any, options: any, done: any) {
|
|
57
|
+
files.forEach(async (fp: any) => {
|
|
58
|
+
let stat = fs.statSync(fp);
|
|
59
|
+
if (stat.isFile()) {
|
|
60
|
+
this.fontInstall(fp, stat, options);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return done(null, this);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
fontInstall(fp: any, stat: any, options: any) {
|
|
68
|
+
let font = new FontObject(fp);
|
|
69
|
+
|
|
70
|
+
if (font.hasError()) {
|
|
71
|
+
this.errors.push(font.getError());
|
|
72
|
+
} else {
|
|
73
|
+
|
|
74
|
+
let fileSize = stat.size;
|
|
75
|
+
let fileType = mime.getType(fp);
|
|
76
|
+
|
|
77
|
+
let data: any = {
|
|
78
|
+
file_path: fp,
|
|
79
|
+
file_name: path.basename(fp),
|
|
80
|
+
file_size: fileSize,
|
|
81
|
+
file_size_pretty: prettyBytes(fileSize),
|
|
82
|
+
file_type: fileType,
|
|
83
|
+
installable: installable.includes(fileType),
|
|
84
|
+
...options
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
this.connectionManager.getStoreRepository().create({ ...data, ...font.getNamesTable() });
|
|
89
|
+
} catch(err) {
|
|
90
|
+
this.errors.push(err.message);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.counter++;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const command_1 = require("../helpers/command");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
class FontInstaller {
|
|
15
|
+
constructor(systemManager, connectionManager) {
|
|
16
|
+
this.systemManager = systemManager;
|
|
17
|
+
this.connectionManager = connectionManager;
|
|
18
|
+
}
|
|
19
|
+
activate(args) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const fonts = (args.files && args.files.length) ? args.files : [];
|
|
22
|
+
const temporary = (args.temporary && args.temporary === true) ? true : false;
|
|
23
|
+
const activate = (args.activate && args.activate === true) ? 1 : 0;
|
|
24
|
+
if (args.collectionId) {
|
|
25
|
+
let collectionId = parseInt(args.collectionId);
|
|
26
|
+
let results = yield this.connectionManager.getStore().find({ where: { collection_id: collectionId } });
|
|
27
|
+
return yield this.run({ files: results, activate, temporary }).then(() => {
|
|
28
|
+
if (temporary) {
|
|
29
|
+
this.connectionManager.getStoreRepository().temporaryCollection(collectionId, activate);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.connectionManager.getStoreRepository().activateCollection(collectionId, activate);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return yield this.run(args).then(() => {
|
|
38
|
+
let ids = fonts.map((item) => item.id);
|
|
39
|
+
if (temporary) {
|
|
40
|
+
this.connectionManager.getStoreRepository().temporaryByIds(ids, activate);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.connectionManager.getStoreRepository().activateByIds(ids, activate);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
run(args) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const platform = this.systemManager.getPlatform();
|
|
52
|
+
const executable = this.systemManager.getExecutable();
|
|
53
|
+
const activate = (args.activate) ? 'install' : 'uninstall';
|
|
54
|
+
const temporary = (platform === "win" && args.temporary && args.temporary === true) ? '--temporary=true' : '--temporary=false';
|
|
55
|
+
const files = args.files.map((item) => `"${path.normalize(item.file_path)}"`).join(" ");
|
|
56
|
+
const command = `${executable} ${activate} ${temporary} ${files}`;
|
|
57
|
+
if (platform === 'win') {
|
|
58
|
+
return (0, command_1.prompt)(command, { name: "Font Activation" });
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return (0, command_1.execute)(command);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.default = FontInstaller;
|
|
67
|
+
//# sourceMappingURL=FontInstaller.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import SystemManager from "./SystemManager";
|
|
2
|
+
import ConnectionManager from "./ConnectionManager";
|
|
3
|
+
import { prompt, execute } from "../helpers/command"
|
|
4
|
+
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
export default class FontInstaller {
|
|
8
|
+
|
|
9
|
+
systemManager: SystemManager;
|
|
10
|
+
connectionManager: ConnectionManager;
|
|
11
|
+
|
|
12
|
+
constructor(
|
|
13
|
+
systemManager: SystemManager,
|
|
14
|
+
connectionManager: ConnectionManager
|
|
15
|
+
) {
|
|
16
|
+
this.systemManager = systemManager;
|
|
17
|
+
this.connectionManager = connectionManager;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async activate(args: any) {
|
|
21
|
+
const fonts = (args.files && args.files.length) ? args.files : [];
|
|
22
|
+
const temporary = (args.temporary && args.temporary === true) ? true : false;
|
|
23
|
+
const activate = (args.activate && args.activate === true) ? 1 : 0;
|
|
24
|
+
|
|
25
|
+
if (args.collectionId) {
|
|
26
|
+
let collectionId = parseInt(args.collectionId);
|
|
27
|
+
let results = await this.connectionManager.getStore().find({ where: { collection_id: collectionId } });
|
|
28
|
+
return await this.run({ files: results, activate, temporary }).then(() => {
|
|
29
|
+
if (temporary) {
|
|
30
|
+
this.connectionManager.getStoreRepository().temporaryCollection(collectionId, activate);
|
|
31
|
+
} else {
|
|
32
|
+
this.connectionManager.getStoreRepository().activateCollection(collectionId, activate);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
return await this.run(args).then(() => {
|
|
37
|
+
let ids = fonts.map((item: any) => item.id);
|
|
38
|
+
if (temporary) {
|
|
39
|
+
this.connectionManager.getStoreRepository().temporaryByIds(ids, activate);
|
|
40
|
+
} else {
|
|
41
|
+
this.connectionManager.getStoreRepository().activateByIds(ids, activate);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async run(args: any) {
|
|
48
|
+
const platform = this.systemManager.getPlatform();
|
|
49
|
+
const executable = this.systemManager.getExecutable();
|
|
50
|
+
|
|
51
|
+
const activate = (args.activate) ? 'install' : 'uninstall';
|
|
52
|
+
const temporary = (platform === "win" && args.temporary && args.temporary === true) ? '--temporary=true' : '--temporary=false';
|
|
53
|
+
const files = args.files.map((item: any) => `"${path.normalize(item.file_path)}"`).join(" ");
|
|
54
|
+
|
|
55
|
+
const command = `${executable} ${activate} ${temporary} ${files}`;
|
|
56
|
+
|
|
57
|
+
if (platform === 'win') {
|
|
58
|
+
return prompt(command, { name: "Font Activation" });
|
|
59
|
+
} else {
|
|
60
|
+
return execute(command);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const electron_1 = require("electron");
|
|
13
|
+
const FontCatalog_1 = require("./FontCatalog");
|
|
14
|
+
const FontFinder_1 = require("./FontFinder");
|
|
15
|
+
const FontInstaller_1 = require("./FontInstaller");
|
|
16
|
+
const command_1 = require("../helpers/command");
|
|
17
|
+
const random_1 = require("../helpers/random");
|
|
18
|
+
const StorageType_1 = require("../enums/StorageType");
|
|
19
|
+
const path = require("path");
|
|
20
|
+
const fetch = require('node-fetch');
|
|
21
|
+
class FontManager {
|
|
22
|
+
constructor(systemManager, configManager, connectionManager) {
|
|
23
|
+
this.systemManager = systemManager;
|
|
24
|
+
this.configManager = configManager;
|
|
25
|
+
this.connectionManager = connectionManager;
|
|
26
|
+
}
|
|
27
|
+
fetchLatestNews(args) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const response = yield fetch(args.endpoint);
|
|
30
|
+
return yield response.json();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
systemAuthenticate(args) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
args.status = 'ok';
|
|
36
|
+
this.configManager.set(StorageType_1.StorageType.User, args);
|
|
37
|
+
return this.configManager.get(StorageType_1.StorageType.User);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
executeCommand(args) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
return yield (0, command_1.execute)(args.cmd, args.options);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
return err;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
scanFiles(files, options) {
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
let finder = new FontFinder_1.default(this.connectionManager);
|
|
53
|
+
finder.scanFiles(files, options, (err) => {
|
|
54
|
+
if (err) {
|
|
55
|
+
return reject(err);
|
|
56
|
+
}
|
|
57
|
+
return resolve({});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
scanFolders(dir, options) {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
let finder = new FontFinder_1.default(this.connectionManager);
|
|
64
|
+
finder.scanFolders(dir, options, (err) => {
|
|
65
|
+
if (err) {
|
|
66
|
+
return reject(err);
|
|
67
|
+
}
|
|
68
|
+
return resolve({});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
fontInstaller(options) {
|
|
73
|
+
let installer = new FontInstaller_1.default(this.systemManager, this.connectionManager);
|
|
74
|
+
return installer.activate(options);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @todo
|
|
78
|
+
*/
|
|
79
|
+
folderInstaller(options) {
|
|
80
|
+
let installer = new FontInstaller_1.default(this.systemManager, this.connectionManager);
|
|
81
|
+
return installer.activate(options);
|
|
82
|
+
}
|
|
83
|
+
getMapFilePaths(files, dest) {
|
|
84
|
+
return files.map((file) => dest + path.sep + path.basename(file));
|
|
85
|
+
}
|
|
86
|
+
getSourceFolder(sourceFolder) {
|
|
87
|
+
return path.normalize(sourceFolder);
|
|
88
|
+
}
|
|
89
|
+
getDestinationFolder() {
|
|
90
|
+
return path.normalize(this.systemManager.getCatalogPath() + path.sep + Date.now() + (0, random_1.randNumber)(7));
|
|
91
|
+
}
|
|
92
|
+
getSourceDestinationFolders(sourceFolder) {
|
|
93
|
+
const src = this.getSourceFolder(sourceFolder);
|
|
94
|
+
const dest = this.getDestinationFolder();
|
|
95
|
+
return { src, dest };
|
|
96
|
+
}
|
|
97
|
+
createCatalog(folder) {
|
|
98
|
+
const catalog = new FontCatalog_1.default(this.systemManager);
|
|
99
|
+
return catalog.createCatalog(folder);
|
|
100
|
+
}
|
|
101
|
+
copyFiles(files, dest) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
const catalog = new FontCatalog_1.default(this.systemManager);
|
|
105
|
+
catalog.copyFiles(files, dest, (err, stdout) => {
|
|
106
|
+
if (err) {
|
|
107
|
+
return reject(err);
|
|
108
|
+
}
|
|
109
|
+
return resolve({});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
copyFolders(src, dest) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
const catalog = new FontCatalog_1.default(this.systemManager);
|
|
118
|
+
catalog.copyFolders(src, dest, (err, stdout) => {
|
|
119
|
+
if (err) {
|
|
120
|
+
return reject(err);
|
|
121
|
+
}
|
|
122
|
+
return resolve({});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
showMessageBox(options) {
|
|
128
|
+
return electron_1.dialog.showMessageBox(null, options);
|
|
129
|
+
}
|
|
130
|
+
showOpenDialog(options) {
|
|
131
|
+
return electron_1.dialog.showOpenDialog(options);
|
|
132
|
+
}
|
|
133
|
+
beep() {
|
|
134
|
+
return electron_1.shell.beep();
|
|
135
|
+
}
|
|
136
|
+
openPath(path) {
|
|
137
|
+
electron_1.shell.openPath(path);
|
|
138
|
+
}
|
|
139
|
+
openExternal(url) {
|
|
140
|
+
electron_1.shell.openExternal(url);
|
|
141
|
+
}
|
|
142
|
+
showItemInFolder(fullPath) {
|
|
143
|
+
electron_1.shell.showItemInFolder(fullPath);
|
|
144
|
+
}
|
|
145
|
+
reLaunch() {
|
|
146
|
+
electron_1.app.relaunch();
|
|
147
|
+
electron_1.app.quit();
|
|
148
|
+
}
|
|
149
|
+
exit() {
|
|
150
|
+
electron_1.app.exit();
|
|
151
|
+
}
|
|
152
|
+
quit() {
|
|
153
|
+
electron_1.app.quit();
|
|
154
|
+
}
|
|
155
|
+
reloadWindow() {
|
|
156
|
+
const windows = electron_1.BrowserWindow.getAllWindows();
|
|
157
|
+
if (windows && windows.length) {
|
|
158
|
+
for (const win of windows) {
|
|
159
|
+
win.webContents.reloadIgnoringCache();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.default = FontManager;
|
|
165
|
+
//# sourceMappingURL=FontManager.js.map
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { app, dialog, BrowserWindow, shell } from 'electron';
|
|
2
|
+
|
|
3
|
+
import SystemManager from './SystemManager';
|
|
4
|
+
import ConfigManager from './ConfigManager';
|
|
5
|
+
import ConnectionManager from './ConnectionManager';
|
|
6
|
+
|
|
7
|
+
import FontCatalog from './FontCatalog';
|
|
8
|
+
import FontFinder from './FontFinder';
|
|
9
|
+
import FontInstaller from './FontInstaller';
|
|
10
|
+
|
|
11
|
+
import { execute } from '../helpers/command';
|
|
12
|
+
import { randNumber } from '../helpers/random';
|
|
13
|
+
|
|
14
|
+
import { StorageType } from '../enums/StorageType';
|
|
15
|
+
|
|
16
|
+
import * as path from 'path';
|
|
17
|
+
|
|
18
|
+
const fetch = require('node-fetch');
|
|
19
|
+
|
|
20
|
+
export default class FontManager {
|
|
21
|
+
|
|
22
|
+
systemManager: SystemManager;
|
|
23
|
+
configManager: ConfigManager;
|
|
24
|
+
connectionManager: ConnectionManager;
|
|
25
|
+
|
|
26
|
+
constructor(systemManager: SystemManager, configManager: ConfigManager, connectionManager: ConnectionManager) {
|
|
27
|
+
this.systemManager = systemManager;
|
|
28
|
+
this.configManager = configManager;
|
|
29
|
+
this.connectionManager = connectionManager;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async fetchLatestNews(args: any) {
|
|
33
|
+
const response = await fetch(args.endpoint);
|
|
34
|
+
return await response.json();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async systemAuthenticate(args: any) {
|
|
38
|
+
args.status = 'ok';
|
|
39
|
+
this.configManager.set(StorageType.User, args);
|
|
40
|
+
return this.configManager.get(StorageType.User);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async executeCommand(args: any) {
|
|
44
|
+
try {
|
|
45
|
+
return await execute(args.cmd, args.options);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
return err;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
scanFiles(files: string[], options: any) {
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
let finder = new FontFinder(this.connectionManager);
|
|
54
|
+
finder.scanFiles(files, options, (err: any) => {
|
|
55
|
+
if (err) { return reject(err); }
|
|
56
|
+
return resolve({});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
scanFolders(dir: any, options: any) {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
let finder = new FontFinder(this.connectionManager);
|
|
64
|
+
finder.scanFolders(dir, options, (err: any) => {
|
|
65
|
+
if (err) { return reject(err); }
|
|
66
|
+
return resolve({});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fontInstaller(options: any) {
|
|
72
|
+
let installer = new FontInstaller(this.systemManager, this.connectionManager);
|
|
73
|
+
return installer.activate(options);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @todo
|
|
78
|
+
*/
|
|
79
|
+
folderInstaller(options: any) {
|
|
80
|
+
let installer = new FontInstaller(this.systemManager, this.connectionManager);
|
|
81
|
+
return installer.activate(options);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getMapFilePaths(files: string[], dest: string) {
|
|
85
|
+
return files.map((file: string) => dest + path.sep + path.basename(file));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getSourceFolder(sourceFolder: string) {
|
|
89
|
+
return path.normalize(sourceFolder);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getDestinationFolder() {
|
|
93
|
+
return path.normalize(this.systemManager.getCatalogPath() + path.sep + Date.now() + randNumber(7));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getSourceDestinationFolders(sourceFolder: string) {
|
|
97
|
+
const src = this.getSourceFolder(sourceFolder);
|
|
98
|
+
const dest = this.getDestinationFolder();
|
|
99
|
+
return { src, dest }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
createCatalog(folder: string) {
|
|
103
|
+
const catalog = new FontCatalog(this.systemManager);
|
|
104
|
+
return catalog.createCatalog(folder);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async copyFiles(files: string[], dest: string) {
|
|
108
|
+
return new Promise((resolve, reject) => {
|
|
109
|
+
const catalog = new FontCatalog(this.systemManager);
|
|
110
|
+
catalog.copyFiles(files, dest, (err: any, stdout: any) => {
|
|
111
|
+
if (err) { return reject(err); }
|
|
112
|
+
return resolve({});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async copyFolders(src: string, dest: string) {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const catalog = new FontCatalog(this.systemManager);
|
|
120
|
+
catalog.copyFolders(src, dest, (err: any, stdout: any) => {
|
|
121
|
+
if (err) { return reject(err); }
|
|
122
|
+
return resolve({});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
showMessageBox(options: any) {
|
|
128
|
+
return dialog.showMessageBox(null, options);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
showOpenDialog(options: any) {
|
|
132
|
+
return dialog.showOpenDialog(options);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
beep() {
|
|
136
|
+
return shell.beep()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
openPath(path: string) {
|
|
140
|
+
shell.openPath(path)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
openExternal(url: string) {
|
|
144
|
+
shell.openExternal(url)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
showItemInFolder(fullPath: string) {
|
|
148
|
+
shell.showItemInFolder(fullPath);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
reLaunch() {
|
|
152
|
+
app.relaunch();
|
|
153
|
+
app.quit();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
exit() {
|
|
157
|
+
app.exit();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
quit() {
|
|
161
|
+
app.quit();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
reloadWindow() {
|
|
165
|
+
const windows = BrowserWindow.getAllWindows();
|
|
166
|
+
if (windows && windows.length) {
|
|
167
|
+
for (const win of windows) {
|
|
168
|
+
win.webContents.reloadIgnoringCache();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const opentype = require("opentype.js");
|
|
4
|
+
class FontObject {
|
|
5
|
+
constructor(fp) {
|
|
6
|
+
try {
|
|
7
|
+
this.setFont(opentype.loadSync(fp));
|
|
8
|
+
}
|
|
9
|
+
catch (err) {
|
|
10
|
+
this.setError(fp, err.message);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
setFont(font) {
|
|
14
|
+
this.font = font;
|
|
15
|
+
}
|
|
16
|
+
getFont() {
|
|
17
|
+
return this.font;
|
|
18
|
+
}
|
|
19
|
+
setError(file, message) {
|
|
20
|
+
this.error = { file, message };
|
|
21
|
+
}
|
|
22
|
+
getError() {
|
|
23
|
+
return this.error;
|
|
24
|
+
}
|
|
25
|
+
hasError() {
|
|
26
|
+
return this.error ? true : false;
|
|
27
|
+
}
|
|
28
|
+
getNamesTable() {
|
|
29
|
+
const names = (this.font && this.font.names) ? this.font.names : false;
|
|
30
|
+
let item = {};
|
|
31
|
+
item.compatible_full_name = (names && names.compatibleFullName) ? names.compatibleFullName.en : "";
|
|
32
|
+
item.copyright = (names && names.copyright) ? names.copyright.en : "";
|
|
33
|
+
item.description = (names && names.description) ? names.description.en : "";
|
|
34
|
+
item.designer = (names && names.designer) ? names.designer.en : "";
|
|
35
|
+
item.designer_url = (names && names.designerURL) ? names.designerURL.en : "";
|
|
36
|
+
item.font_family = (names && names.fontFamily) ? names.fontFamily.en : "";
|
|
37
|
+
item.font_subfamily = (names && names.fontSubfamily) ? names.fontSubfamily.en : "";
|
|
38
|
+
item.full_name = (names && names.fullName) ? names.fullName.en : "";
|
|
39
|
+
item.license = (names && names.license) ? names.license.en : "";
|
|
40
|
+
item.license_url = (names && names.licenseURL) ? names.licenseURL.en : "";
|
|
41
|
+
item.manufacturer = (names && names.manufacturer) ? names.manufacturer.en : "";
|
|
42
|
+
item.manufacturer_url = (names && names.manufacturerURL) ? names.manufacturerURL.en : "";
|
|
43
|
+
item.post_script_name = (names && names.postScriptName) ? names.postScriptName.en : "";
|
|
44
|
+
item.preferred_family = (names && names.preferredFamily) ? names.preferredFamily.en : "";
|
|
45
|
+
item.preferred_sub_family = (names && names.preferredSubfamily) ? names.preferredSubfamily.en : "";
|
|
46
|
+
item.sample_text = (names && names.sampleText) ? names.sampleText.en : "";
|
|
47
|
+
item.trademark = (names && names.trademark) ? names.trademark.en : "";
|
|
48
|
+
item.unique_id = (names && names.uniqueID) ? names.uniqueID.en : "";
|
|
49
|
+
item.version = (names && names.version) ? names.version.en : "";
|
|
50
|
+
return item;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.default = FontObject;
|
|
54
|
+
//# sourceMappingURL=FontObject.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const opentype = require("opentype.js");
|
|
2
|
+
|
|
3
|
+
export default class FontObject {
|
|
4
|
+
|
|
5
|
+
font: any;
|
|
6
|
+
error: any;
|
|
7
|
+
|
|
8
|
+
constructor(fp: string) {
|
|
9
|
+
try {
|
|
10
|
+
this.setFont(opentype.loadSync(fp));
|
|
11
|
+
} catch (err) {
|
|
12
|
+
this.setError(fp, err.message);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
setFont(font: any) {
|
|
17
|
+
this.font = font;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getFont() {
|
|
21
|
+
return this.font;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
setError(file: string, message: string) {
|
|
25
|
+
this.error = { file, message };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getError() {
|
|
29
|
+
return this.error;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
hasError() {
|
|
33
|
+
return this.error ? true : false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getNamesTable() {
|
|
37
|
+
const names = (this.font && this.font.names) ? this.font.names : false;
|
|
38
|
+
|
|
39
|
+
let item: any = {};
|
|
40
|
+
item.compatible_full_name = (names && names.compatibleFullName) ? names.compatibleFullName.en : "";
|
|
41
|
+
item.copyright = (names && names.copyright) ? names.copyright.en : "";
|
|
42
|
+
item.description = (names && names.description) ? names.description.en : "";
|
|
43
|
+
item.designer = (names && names.designer) ? names.designer.en : "";
|
|
44
|
+
item.designer_url = (names && names.designerURL) ? names.designerURL.en : "";
|
|
45
|
+
item.font_family = (names && names.fontFamily) ? names.fontFamily.en : "";
|
|
46
|
+
item.font_subfamily = (names && names.fontSubfamily) ? names.fontSubfamily.en : "";
|
|
47
|
+
item.full_name = (names && names.fullName) ? names.fullName.en : "";
|
|
48
|
+
item.license = (names && names.license) ? names.license.en : "";
|
|
49
|
+
item.license_url = (names && names.licenseURL) ? names.licenseURL.en : "";
|
|
50
|
+
item.manufacturer = (names && names.manufacturer) ? names.manufacturer.en : "";
|
|
51
|
+
item.manufacturer_url = (names && names.manufacturerURL) ? names.manufacturerURL.en : "";
|
|
52
|
+
item.post_script_name = (names && names.postScriptName) ? names.postScriptName.en : "";
|
|
53
|
+
item.preferred_family = (names && names.preferredFamily) ? names.preferredFamily.en : "";
|
|
54
|
+
item.preferred_sub_family = (names && names.preferredSubfamily) ? names.preferredSubfamily.en : "";
|
|
55
|
+
item.sample_text = (names && names.sampleText) ? names.sampleText.en : "";
|
|
56
|
+
item.trademark = (names && names.trademark) ? names.trademark.en : "";
|
|
57
|
+
item.unique_id = (names && names.uniqueID) ? names.uniqueID.en : "";
|
|
58
|
+
item.version = (names && names.version) ? names.version.en : "";
|
|
59
|
+
|
|
60
|
+
return item;
|
|
61
|
+
}
|
|
62
|
+
}
|