Skip to content

Commit

Permalink
fix rest issues
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonNekoGH committed Jan 3, 2025
1 parent 179787f commit 4f0ab73
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 81 deletions.
9 changes: 0 additions & 9 deletions packages/tamagotchi/.editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions packages/tamagotchi/.vscode/extensions.json

This file was deleted.

39 changes: 0 additions & 39 deletions packages/tamagotchi/.vscode/launch.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/tamagotchi/.vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions packages/tamagotchi/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AIRI Tamagotchi
# たまごっち アイリ

A desktop application for AIRI Tamagotchi.
A desktop application for たまごっち アイリ.

## Project Setup

Expand Down
2 changes: 1 addition & 1 deletion packages/tamagotchi/electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
appId: io.ayaka.moeru-ai.airi-tamagotchi
appId: com.github.moeru-ai.airi-tamagotchi
productName: airi
directories:
buildResources: build
Expand Down
4 changes: 2 additions & 2 deletions packages/tamagotchi/electron.vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve } from 'node:path'
import { join, resolve } from 'node:path'
import vue from '@vitejs/plugin-vue'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'

Expand All @@ -12,7 +12,7 @@ export default defineConfig({
renderer: {
resolve: {
alias: {
'@renderer': resolve('src/renderer/src'),
'@renderer': resolve(join('src', 'renderer', 'src')),
},
},
plugins: [vue()],
Expand Down
2 changes: 1 addition & 1 deletion packages/tamagotchi/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@proj-airi/tamagotchi",
"name": "@proj-airi/stage-tamagotchi",
"version": "1.0.0",
"description": "An Electron application with Vue and TypeScript",
"author": "LemonNekoGH",
Expand Down
18 changes: 8 additions & 10 deletions packages/tamagotchi/src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import process from 'node:process'
import { platform } from 'node:process'
import { fileURLToPath } from 'node:url'
import { electronApp, is, optimizer } from '@electron-toolkit/utils'
import { app, BrowserWindow, ipcMain, shell } from 'electron'
import icon from '../../build/icon.png?asset'

function createWindow(): void {
const __dirname = dirname(fileURLToPath(import.meta.url))
const __dirname = dirname(fileURLToPath(import.meta.url))

function createWindow(): void {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 300,
Expand All @@ -20,9 +20,9 @@ function createWindow(): void {
resizable: false,
hasShadow: false,
alwaysOnTop: true,
...(process.platform === 'linux' ? { icon } : {}),
...(platform === 'linux' ? { icon } : {}),
webPreferences: {
preload: join(__dirname, '../preload/index.js'),
preload: join(__dirname, '..', 'preload', 'index.js'),
sandbox: false,
},
})
Expand Down Expand Up @@ -50,7 +50,7 @@ function createWindow(): void {
})
}
else {
mainWindow.loadFile(join(__dirname, '../../out/renderer/index.html'))
mainWindow.loadFile(join(__dirname, '..', '..', 'out', 'renderer', 'index.html'))
}

ipcMain.on('move-window', (_, dx, dy) => {
Expand All @@ -64,7 +64,7 @@ function createWindow(): void {
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
// Set app user model id for windows
electronApp.setAppUserModelId('moe.ayaka.proj-airi')
electronApp.setAppUserModelId('com.github.moeru-ai.airi-tamagotchi')

// Default open or close DevTools by F12 in development
// and ignore CommandOrControl + R in production.
Expand All @@ -74,8 +74,6 @@ app.whenReady().then(() => {
})

// IPC test
// eslint-disable-next-line no-console
ipcMain.on('ping', () => console.log('pong'))
ipcMain.on('quit', () => app.quit())

createWindow()
Expand All @@ -93,7 +91,7 @@ app.whenReady().then(() => {
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
if (platform !== 'darwin') {
app.quit()
}
})
Expand Down
4 changes: 2 additions & 2 deletions packages/tamagotchi/src/preload/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import process from 'node:process'
import { contextIsolated } from 'node:process'
import { electronAPI } from '@electron-toolkit/preload'
import { contextBridge } from 'electron'

Expand All @@ -8,7 +8,7 @@ const api = {}
// Use `contextBridge` APIs to expose Electron APIs to
// renderer only if context isolation is enabled, otherwise
// just add to the DOM global.
if (process.contextIsolated) {
if (contextIsolated) {
try {
contextBridge.exposeInMainWorld('electron', electronAPI)
contextBridge.exposeInMainWorld('api', api)
Expand Down
3 changes: 2 additions & 1 deletion packages/tamagotchi/src/renderer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<html>
<head>
<meta charset="UTF-8" />
<title>Electron</title>
<title>アイリ</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" />
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta
http-equiv="Content-Security-Policy"
Expand Down

0 comments on commit 4f0ab73

Please sign in to comment.