Compare commits
3 Commits
72aa26c880
...
6f9442a02e
| Author | SHA1 | Date |
|---|---|---|
|
|
6f9442a02e | |
|
|
933bed2c81 | |
|
|
f8354882a7 |
|
|
@ -1,43 +1,59 @@
|
||||||
appId: com.electron.app
|
appId: com.electron.app
|
||||||
productName: New Item
|
productName: New Item
|
||||||
|
|
||||||
directories:
|
directories:
|
||||||
buildResources: build
|
buildResources: build
|
||||||
|
|
||||||
files:
|
files:
|
||||||
- '!**/.vscode/*'
|
- '!**/.vscode/*'
|
||||||
- '!src/*'
|
- '!src/*'
|
||||||
- '!electron.vite.config.{js,ts,mjs,cjs}'
|
- '!electron.vite.config.{js,ts,mjs,cjs}'
|
||||||
- '!{.eslintcache,eslint.config.mjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
|
- '!{.eslintcache,eslint.config.mjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
|
||||||
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
||||||
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
|
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
|
||||||
|
|
||||||
asarUnpack:
|
asarUnpack:
|
||||||
- resources/**
|
- resources/**
|
||||||
|
|
||||||
win:
|
win:
|
||||||
executableName: New-item
|
target: nsis
|
||||||
nsis:
|
executableName: New-item
|
||||||
artifactName: ${name}-${version}-setup.${ext}
|
publisherName: apactech
|
||||||
shortcutName: ${productName}
|
|
||||||
uninstallDisplayName: ${productName}
|
portable:
|
||||||
createDesktopShortcut: always
|
artifactName: ${name}-${version}.exe
|
||||||
|
|
||||||
|
nsis: # vẫn giữ để dùng nếu muốn cài đặt, nhưng sẽ không tạo nếu chỉ chọn portable
|
||||||
|
artifactName: ${name}-${version}-setup.${ext}
|
||||||
|
shortcutName: ${productName}
|
||||||
|
uninstallDisplayName: ${productName}
|
||||||
|
createDesktopShortcut: always
|
||||||
|
|
||||||
mac:
|
mac:
|
||||||
entitlementsInherit: build/entitlements.mac.plist
|
entitlementsInherit: build/entitlements.mac.plist
|
||||||
extendInfo:
|
extendInfo:
|
||||||
- NSCameraUsageDescription: Application requests access to the device's camera.
|
- NSCameraUsageDescription: Application requests access to the device's camera.
|
||||||
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
||||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||||
notarize: false
|
notarize: false
|
||||||
|
|
||||||
dmg:
|
dmg:
|
||||||
artifactName: ${name}-${version}.${ext}
|
artifactName: ${name}-${version}.${ext}
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
target:
|
target:
|
||||||
- AppImage
|
- AppImage
|
||||||
- snap
|
- snap
|
||||||
- deb
|
- deb
|
||||||
maintainer: electronjs.org
|
maintainer: electronjs.org
|
||||||
category: Utility
|
category: Utility
|
||||||
|
|
||||||
appImage:
|
appImage:
|
||||||
artifactName: ${name}-${version}.${ext}
|
artifactName: ${name}-${version}.${ext}
|
||||||
|
|
||||||
npmRebuild: false
|
npmRebuild: false
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
provider: generic
|
provider: generic
|
||||||
url: https://example.com/auto-updates
|
url: https://apactech.io/auto-updates
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "new-item-app",
|
"name": "new-item-app",
|
||||||
"version": "1.0.0",
|
"version": "1.0.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "new-item-app",
|
"name": "new-item-app",
|
||||||
"version": "1.0.0",
|
"version": "1.0.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron-toolkit/preload": "^3.0.1",
|
"@electron-toolkit/preload": "^3.0.1",
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.9.0",
|
||||||
"electron-updater": "^6.3.9",
|
"electron-updater": "^6.3.9",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"pusher-js": "^8.4.0"
|
"pusher-js": "^8.4.0",
|
||||||
|
"windows-shortcuts": "^0.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-toolkit/eslint-config-prettier": "^3.0.0",
|
"@electron-toolkit/eslint-config-prettier": "^3.0.0",
|
||||||
|
|
@ -10979,6 +10980,12 @@
|
||||||
"string-width": "^1.0.2 || 2 || 3 || 4"
|
"string-width": "^1.0.2 || 2 || 3 || 4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/windows-shortcuts": {
|
||||||
|
"version": "0.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/windows-shortcuts/-/windows-shortcuts-0.1.6.tgz",
|
||||||
|
"integrity": "sha512-kjkb3Hmmmg7jwnOb+29AOmoEEA1L/JeLsMOYovpLxYpuc+fN0R+pr8sMwep3JFhUZloxyw1XTzq8n3HugXkqBA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/word-wrap": {
|
"node_modules/word-wrap": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "new-item-app",
|
"name": "new-item-app",
|
||||||
"version": "1.0.3",
|
"version": "1.0.5",
|
||||||
"description": "An Electron application with React and TypeScript",
|
"description": "new item application is active",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "example.com",
|
"author": "apactech.io",
|
||||||
"homepage": "https://electron-vite.org",
|
"homepage": "https://electron-vite.org",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.9.0",
|
||||||
"electron-updater": "^6.3.9",
|
"electron-updater": "^6.3.9",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"pusher-js": "^8.4.0"
|
"pusher-js": "^8.4.0",
|
||||||
|
"windows-shortcuts": "^0.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-toolkit/eslint-config-prettier": "^3.0.0",
|
"@electron-toolkit/eslint-config-prettier": "^3.0.0",
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ import { app, BrowserWindow, globalShortcut, ipcMain, Menu, screen, shell, Tray
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path, { join } from 'path'
|
import path, { join } from 'path'
|
||||||
import icon from '../../resources/icon.png?asset'
|
import icon from '../../resources/icon.png?asset'
|
||||||
|
import ws from 'windows-shortcuts'
|
||||||
|
|
||||||
let mainWindow: null | BrowserWindow = null
|
let mainWindow: null | BrowserWindow = null
|
||||||
let isQuiting = false
|
let isQuiting = false
|
||||||
const startupFlagFile = path.join(app.getPath('userData'), 'startup-set.flag')
|
|
||||||
|
|
||||||
function createWindow(): void {
|
function createWindow(): void {
|
||||||
// Get Screen width, height
|
// Get Screen width, height
|
||||||
|
|
@ -112,16 +112,22 @@ function createTray() {
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
if (!fs.existsSync(startupFlagFile)) {
|
// const startupFlagFile = path.join(app.getPath('userData'), 'startup-set.flag')
|
||||||
app.setLoginItemSettings({
|
const startupFolder = path.join(
|
||||||
openAtLogin: true,
|
app.getPath('appData'),
|
||||||
path: process.execPath,
|
'Microsoft\\Windows\\Start Menu\\Programs\\Startup'
|
||||||
args: []
|
)
|
||||||
|
const shortcutPath = path.join(startupFolder, 'New Item.lnk')
|
||||||
|
|
||||||
|
if (!fs.existsSync(shortcutPath)) {
|
||||||
|
ws.create(shortcutPath, {
|
||||||
|
target: process.execPath,
|
||||||
|
workingDir: path.dirname(process.execPath),
|
||||||
|
runStyle: 1,
|
||||||
|
desc: 'Start New Item with Windows',
|
||||||
|
icon: process.execPath
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.writeFileSync(startupFlagFile, 'ok')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set app user model id for windows
|
// Set app user model id for windows
|
||||||
electronApp.setAppUserModelId('com.electron')
|
electronApp.setAppUserModelId('com.electron')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const CardItem: React.FC<CardItemProps> = ({ item, hotItem }) => {
|
||||||
justifyContent: 'center'
|
justifyContent: 'center'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{true ? (
|
{hotItem ? (
|
||||||
<Box
|
<Box
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue