Currently translated at 94.9% (492 of 518 strings)
Translated using Weblate (French)
Currently translated at 94.2% (488 of 518 strings)
Translated using Weblate (French)
Currently translated at 94.2% (488 of 518 strings)
Translated using Weblate (French)
Currently translated at 90.3% (468 of 518 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: KosmoMoustache <KosmoMoustache@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/fr/
Translation: feishin/Translation
Currently translated at 100.0% (518 of 518 strings)
Translated using Weblate (Czech)
Currently translated at 100.0% (518 of 518 strings)
Added translation using Weblate (Czech)
Co-authored-by: Fjuro <ifjuro@proton.me>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/cs/
Translation: feishin/Translation
Currently translated at 87.0% (451 of 518 strings)
Translated using Weblate (German)
Currently translated at 87.0% (451 of 518 strings)
Translated using Weblate (German)
Currently translated at 62.7% (325 of 518 strings)
Translated using Weblate (German)
Currently translated at 62.7% (325 of 518 strings)
Translated using Weblate (German)
Currently translated at 59.6% (309 of 518 strings)
Translated using Weblate (German)
Currently translated at 59.6% (309 of 518 strings)
Translated using Weblate (German)
Currently translated at 56.9% (295 of 518 strings)
Translated using Weblate (German)
Currently translated at 56.9% (295 of 518 strings)
Translated using Weblate (German)
Currently translated at 55.4% (287 of 518 strings)
Translated using Weblate (German)
Currently translated at 55.4% (287 of 518 strings)
Translated using Weblate (German)
Currently translated at 53.8% (279 of 518 strings)
Translated using Weblate (German)
Currently translated at 53.8% (279 of 518 strings)
Translated using Weblate (German)
Currently translated at 1.9% (10 of 518 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Kobayashi <kobayashi90@protonmail.ch>
Co-authored-by: Rudi Mentaire <stoertebecker@byom.de>
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/de/
Translation: feishin/Translation
Currently translated at 23.5% (122 of 518 strings)
Translated using Weblate (Portuguese (Brazil))
Currently translated at 22.5% (117 of 518 strings)
Translated using Weblate (Portuguese (Brazil))
Currently translated at 13.3% (69 of 518 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Rafael Vieira <rafaelvieiras@pm.me>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/pt_BR/
Translation: feishin/Translation
Currently translated at 100.0% (518 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (518 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 99.8% (517 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (518 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 95.5% (495 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 92.8% (481 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 91.5% (474 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 89.7% (465 of 518 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Kaiyang Wu <self@origincode.me>
Co-authored-by: kare-Udon <laoliu735@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/zh_Hans/
Translation: feishin/Translation
Updated by "Remove blank strings" hook in Weblate.
Translated using Weblate (Chinese (Simplified))
Currently translated at 89.5% (464 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 56.7% (294 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 51.9% (269 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 51.1% (265 of 518 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 52.0% (265 of 509 strings)
Co-authored-by: Darwin <daerwendeshu@outlook.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: kare-Udon <laoliu735@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/zh_Hans/
Translation: feishin/Translation
Currently translated at 100.0% (518 of 518 strings)
Translated using Weblate (Spanish)
Currently translated at 99.8% (517 of 518 strings)
Translated using Weblate (Spanish)
Currently translated at 99.2% (514 of 518 strings)
Translated using Weblate (Spanish)
Currently translated at 88.6% (459 of 518 strings)
Translated using Weblate (Spanish)
Currently translated at 88.4% (458 of 518 strings)
Translated using Weblate (Spanish)
Currently translated at 88.4% (458 of 518 strings)
Co-authored-by: Fordas <fordas15@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Jeff <jeffvictorli@gmail.com>
Co-authored-by: gallegonovato <fran-carro@hotmail.es>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/es/
Translation: feishin/Translation
Currently translated at 94.2% (488 of 518 strings)
Translated using Weblate (Italian)
Currently translated at 5.5% (29 of 518 strings)
Translated using Weblate (Italian)
Currently translated at 5.0% (26 of 518 strings)
Translated using Weblate (Italian)
Currently translated at 4.2% (22 of 518 strings)
Added translation using Weblate (Italian)
Co-authored-by: Aurora <arci@anche.no>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/it/
Translation: feishin/Translation
Currently translated at 98.8% (512 of 518 strings)
Translated using Weblate (Polish)
Currently translated at 83.2% (431 of 518 strings)
Translated using Weblate (Polish)
Currently translated at 83.2% (431 of 518 strings)
Translated using Weblate (Polish)
Currently translated at 76.2% (395 of 518 strings)
Translated using Weblate (Polish)
Currently translated at 74.6% (380 of 509 strings)
Translated using Weblate (Polish)
Currently translated at 46.5% (237 of 509 strings)
Co-authored-by: 7Adrian <7adrian.mail@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Jeff <jeffvictorli@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/pl/
Translation: feishin/Translation
Updated by "Remove blank strings" hook in Weblate.
Translated using Weblate (Chinese (Simplified))
Currently translated at 51.7% (263 of 508 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 51.7% (263 of 508 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 51.7% (263 of 508 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 15.7% (80 of 508 strings)
Added translation using Weblate (Chinese (Simplified))
Co-authored-by: Darwin <daerwendeshu@outlook.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: ken <kenxu2022@gmail.com>
Co-authored-by: 無情天 <kofzhanganguo@126.com>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/zh_Hans/
Translation: feishin/Translation
Currently translated at 67.9% (345 of 508 strings)
Translated using Weblate (French)
Currently translated at 66.9% (340 of 508 strings)
Translated using Weblate (French)
Currently translated at 50.0% (254 of 508 strings)
Translated using Weblate (French)
Currently translated at 49.6% (252 of 508 strings)
Update translation files
Updated by "Remove blank strings" hook in Weblate.
Translated using Weblate (French)
Currently translated at 49.2% (250 of 508 strings)
Added translation using Weblate (French)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: KosmoMoustache <hosted.weblate.org@kosmo.ovh>
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/
Translate-URL: https://hosted.weblate.org/projects/feishin/translation/fr/
Translation: feishin/Translation
* [bugfix/feature]: Improve ratings
Fix: add preventDefault/stopPropagation to prevent scrolling to top in queue
Feat: instead of double click for clear, click on same value
* initial idea for playback rate
* Add transparency to dropdown
* Move playback speed component to right controls
* Set mpv speed on startup
---------
Co-authored-by: jeffvli <jeffvictorli@gmail.com>
* [Feature] Support changing accent/primary color
- adds color picker to settings with five swatches (blue default, yellow green and red imported from sonixd, purple new)
- changing color will change the appropriate css variable
* Remove hover styles that use an alternate primary
---------
Co-authored-by: Jeff <42182408+jeffvli@users.noreply.github.com>
Co-authored-by: jeffvli <jeffvictorli@gmail.com>
* [feature]: Support using system fonts
Uses the **experimental** queryLocalFonts API, when prompted, to get the fonts and do CSS.
Resolves#270 and #288 (by proxy)
Caveats/notes:
- This is experimental, and is only supported by Chrome/Chromium/Edgeium (see https://caniuse.com/?search=querylocalfonts)
- As far as I can tell, the only way to dynamically change the font (shown in https://wicg.github.io/local-font-access/#example-style-with-local-fonts) was by DOM manipulation; css variables did not seem to work
- This shows **all** fonts, including their variants (bold/italic/etc); given that the style names could be localized, not sure of a way to parse this (on my system, for instance, I had 859 different combinations)
- I made fonts a separate top-level setting because it was easier to manipulate without causing as many rerenders; feel free to put that back
* add permission chec
* add electron magic to support custom font
* restrict content types
* [bugfix]: fix queue offset when removing tracks
* Fix song index numbers when removing songs
---------
Co-authored-by: jeffvli <jeffvictorli@gmail.com>
* add more emphasis to current song
* add css indicator (rivolumelineup)
* don't use absolute position, support album track number
* Respect order of set-queue function (fix race condition)
* Fix table row actions button on album detail and play queue
* Fix album detail table customizations
* Bump to v0.4.1
* Fix opacity mask for unsynced lyrics container
* Separate sidebar icons to new component
- Fixes react render issue
* Add app focus hook
* Remove css play image
* Add player status as cell refresh condition for queue
* Add current song images
* Add current song styles for all song tables
* Revert row index cell width
* Remove animated svg on browser
---------
Co-authored-by: jeffvli <jeffvictorli@gmail.com>
Co-authored-by: Jeff <42182408+jeffvli@users.noreply.github.com>
* In the fullscreen player use dynamic resolution for the main image
* Use ceil instead of round
* Add types and lint
---------
Co-authored-by: Jeff <42182408+jeffvli@users.noreply.github.com>
* special socket for dev; defer to default otherwise
* Add write-all permissions to docker push
* special socket for dev; defer to default otherwise
---------
Co-authored-by: jeffvli <jeffvictorli@gmail.com>
* add opacity
* add background for song metadata
* Add padding and border radius to opacity elements
* Remove font-weight transition on active lyrics (#233)
---------
Co-authored-by: jeffvli <jeffvictorli@gmail.com>
- set mpv settings only after it has successfully started (at least on linux, settings were not taken)
- change timing of restore queue to behave properly
- Fix add next behavior when shuffle is enabled
- Fix shuffled queue when songs are removed from queue
- Fix queue indices when currently playing song is removed
- Re-shuffle queue after queue is finished when shuffle is enabled
* initial implementation for password saving
* support restoring password in interceptor
* Fix modal overflow and position styles
* warn about 429, better error handling
---------
Co-authored-by: jeffvli <jeffvictorli@gmail.com>
Co-authored-by: Jeff <42182408+jeffvli@users.noreply.github.com>
- Make the settings text actually consistent with behavior
- Add metadata (artist/track name) for fetched tracks
- Add ability to remove incorrectly fetched lyric
- Add lyric fetch cache; save the last 10 fetches
- Add ability to change offset in full screen, add more comments
- uses a somewhat more sane way to parse lyrics and teardown timeouts
- adds 'seeked' to setCurrentTime to make detecting seeks in lyric much easier
- adds ability to fetch lyrics from genius/netease (desktop only)
* Add store controls for fullscreen player
* Normalize styles for playback config
* Add fullscreen player component
* Add option component
* Update player controls to use option/popover components
* Add esc hotkey to close player
* Add usePlayerData hook
- On startup, the first time a song is played, mpv will stop after playback
- This adds a loop to the queue handler to automatically retry when failing to add to the queue
* Remove 1920px max width
* Fix position of list controls menu
* Match size and color of search input
* Adjust library header sizing
* Move app menu to sidebar
* Increase row buffer on play queue list
* Fix query builder styles
* Fix playerbar slider track bg
* Adjust titlebar styles
* Fix invalid modal prop
* Various adjustments to detail pages
* Fix sidebar height calculation
* Fix list null indicators, add filter indicator
* Adjust playqueue styles
* Fix jellyfin releaseYear normalization
* Suppress browser context menu on ag-grid
* Add radius to drawer queue -- normalize layout
* Add modal styles to provider theme
* Fix playlist song list pagination
* Add disc number to albums with more than one disc
* Fix query builder boolean values
* Adjust input placeholder color
* Properly handle rating/favorite from context menu on table
* Conform dropdown menu styles to context menu
* Increase sort type select width
* Fix drawer queue radius
* Change primary color
* Prevent volume wheel from invalid values
* Add icons to query builder dropdowns
* Update notification styles
* Update scrollbar thumb styles
* Remove "add to playlist" on smart playlists
* Fix "add to playlist" from context menu
* Update rating types for multiserver support
* Add rating mutation
* Add rating support to table views
* Add rating support on playerbar
* Add hovercard component
* Handle rating from context menu
- Improve context menu components
- Allow left / right icons
- Allow nested menus
* Add selected item count
* Fix context menu auto direction
* Add transition and move portal for context menu
* Re-use context menu for all item dropdowns
* Add ratings to detail pages / double click to clear
* Bump react-query package
* Fix slider bar background to use theme
* Add "scrobbleAtDuration" to settings store
* Add subscribeWithSelector and playCount incrementor
* Add scrobbling API and mutation
* Add scrobble settings
* Begin support for multi-server queue handling
* Dynamically set version on auth header
* Add scrobbling functionality for navidrome/jellyfin
* Add api for add/remove playlist items
* Add playlistItemId property to normalized Song
- This is used for Navidrome to delete songs from playlists
* Add mutations for add/remove from playlist
* Add context modal for playlist add
* Add remove from playlist from context menu
* Set jellyfin to use playlistItemId
* Adjust font sizing
* Add playlist add from detail pages
* Bump mantine to v6-alpha.2
* Add letter spacing to cell text
* Set window control height in px
* Add temp unused routes
* Migrate text title font weights
* Bump mantine to v6 alpha
* Migrate modals / notifications
* Increase header bar to 65px
* Adjust play button props
* Migrate various components
* Migrate various pages and root styles
* Adjust default badge padding
* Fix sidebar spacing
* Fix list header badges
* Adjust default theme
- Result selector runs on every page on every fetch, which means that the uniqueId is not immutable. We need a static index on each item since a playlist can have duplicate song ids
# Number of days of inactivity before an issue becomes stale
daysUntilStale:60
# Number of days of inactivity before a stale issue is closed
daysUntilClose:7
# Issues with these labels will never be considered stale
exemptLabels:
- discussion
- security
# Label to use when marking an issue as stale
staleLabel:wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment:>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
[](https://stand-with-ukraine.pp.ua)
Automatically**](https://github.com/npm/rfcs/blob/latest/implemented/0025-install-peer-deps.md). If you are using a
different package manager, you may need to install some peerDependencies manually.
**Note**: Find more useful forks [here](https://github.com/cawa-93/vite-electron-builder/discussions/categories/forks).
Rewrite of [Sonixd](https://github.com/jeffvli/sonixd).
## Features
### Electron [][electron]
- [x] MPV player backend
- [x] Web player backend
- [x] Modern UI
- [x] Scrobble playback to your server
- [x] Smart playlist editor (Navidrome)
- [x] Synchronized and unsynchronized lyrics support
- [ ] [Request a feature](https://github.com/jeffvli/feishin/issues) or [view taskboard](https://github.com/users/jeffvli/projects/5/views/1)
- This template uses the latest electron version with all the latest security patches.
- The architecture of the application is built according to the
security [guides](https://www.electronjs.org/docs/tutorial/security) and best practices.
- The latest version of the [electron-builder] is used to package the application.
## Screenshots
### Vite [][vite]
- [Vite] is used to bundle all source codes. It's an extremely fast bundler, that has a vast array of amazing features.
You can learn more about how it is arranged in [this](https://www.youtube.com/watch?v=xXrhg26VCSc) video.
- Vite [supports](https://vitejs.dev/guide/env-and-mode.html) reading `.env` files. You can also specify the types of
your environment variables in [`types/env.d.ts`](types/env.d.ts).
- Automatic hot-reloads for the `Main` and `Renderer` processes.
## Getting Started
Vite provides many useful features, such as: `TypeScript`, `TSX/JSX`, `CSS/JSON Importing`, `CSS Modules`
, `Web Assembly` and much more.
### Desktop (recommended)
[See all Vite features](https://vitejs.dev/guide/features.html).
Download the [latest desktop client](https://github.com/jeffvli/feishin/releases). The desktop client is the recommended way to use Feishin. It supports both the MPV and web player backends, as well as includes built-in fetching for lyrics.
If you're using a device running macOS 12 (Monterey) or higher, [check here](https://github.com/jeffvli/feishin/issues/104#issuecomment-1553914730) for instructions on how to remove the app from quarantine.
- The latest version of TypeScript is used for all the source code.
- **Vite** supports TypeScript out of the box. However, it does not support type checking.
- Code formatting rules follow the latest TypeScript recommendations and best practices thanks
to [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin).
### Web and Docker
**[See this discussion](https://github.com/cawa-93/vite-electron-builder/discussions/339)** if you want completely
remove TypeScript.
Visit [https://feishin.vercel.app](https://feishin.vercel.app) to use the hosted web version of Feishin. The web client only supports the web player backend.
Feishin is also available as a Docker image. The images are hosted via `ghcr.io` and are available to view [here](https://github.com/jeffvli/feishin/pkgs/container/feishin). You can run the container using the following commands:
- By default, web pages are built using [Vue]. However, you can easily change that. Or not use additional frameworks at
all.
- Code formatting rules follow the latest Vue recommendations and best practices thanks to [eslint-plugin-vue].
```bash
# Run the latest version
docker run --name feishin -p 9180:9180 ghcr.io/jeffvli/feishin:latest
See [examples of web pages for different frameworks](https://github.com/vitejs/vite/tree/main/packages/create-vite).
### Continuous Integration
- The configured workflow will check the types for each push and PR.
- The configured workflow will check the code style for each push and PR.
- **Automatic tests**
used [Vitest ][vitest]
-- A blazing fast test framework powered by Vite.
- Unit tests are placed within each package and are ran separately.
- End-to-end tests are placed in the root [`tests`](tests) directory and use [playwright].
- Each time you push changes to the `main` branch, the [`release`](.github/workflows/release.yml) workflow starts, which creates a new draft release. For each next commit will be created and replaced artifacts. That way you will always have draft with latest artifacts, and the release can be published once it is ready.
- Code signing supported. See [`release` workflow](.github/workflows/release.yml).
- **Auto-update is supported**. After the release is published, all client applications will download the new version
and install updates silently.
This template configured for GitHub, but electron-builder supports multiple auto-update servers. See [docs](https://www.electron.build/configuration/publish).
## How it works
The template requires a minimum amount [dependencies](package.json). Only **Vite** is used for building, nothing more.
### Project Structure
The structure of this template is very similar to the structure of a monorepo.
The entire source code of the project is divided into three modules (packages) that are each bundled independently:
### Configuration
- [`packages/renderer`](packages/renderer). Responsible for the contents of the application window. In fact, it is a
regular web application. In developer mode, you can even open it in a browser. The development and build process is
the same as for classic web applications. Access to low-level API electrons or Node.js is done through the _preload_
layer.
- [`packages/preload`](packages/preload). Acts as an intermediate bridge between the _renderer_ process and the API
exposed by electron and Node.js. Runs in an _isolated browser context_, but has direct access to the full Node.js
functionality.
See [Checklist: Security Recommendations](https://www.electronjs.org/docs/tutorial/security#2-do-not-enable-nodejs-integration-for-remote-content)
.
- [`packages/main`](packages/main)
Electron [**main script**](https://www.electronjs.org/docs/tutorial/quick-start#create-the-main-script-file). This is
the main process that powers the application. It manages creating and handling the spawned BrowserWindow, setting and
enforcing secure permissions and request handlers. You can also configure it to do much more as per your need, such
as: logging, reporting statistics and health status among others.
1. Upon startup you will be greeted with a prompt to select the path to your MPV binary. If you do not have MPV installed, you can download it [here](https://mpv.io/installation/) or install it using any package manager supported by your OS. After inputting the path, restart the app.
### Build web resources
2. After restarting the app, you will be prompted to select a server. Click the `Open menu` button and select `Manage servers`. Click the `Add server` button in the popup and fill out all applicable details. You will need to enter the full URL to your server, including the protocol and port if applicable (e.g. `https://navidrome.my-server.com` or `http://192.168.0.1:4533`).
The `main` and `preload` packages are built in [library mode](https://vitejs.dev/guide/build.html#library-mode) as it is
simple javascript.
The `renderer` package builds as a regular web app.
-**Navidrome** - For the best experience, select "Save password" when creating the server and configure the `SessionTimeout` setting in your Navidrome config to a larger value (e.g. 72h).
### Compile App
3._Optional_ - If you want to host Feishin on a subpath (not `/`), then pass in the following environment variable: `PUBLIC_PATH=PATH`. For example, to host on `/feishin`, pass in `PUBLIC_PATH=/feishin`.
The next step is to package a ready to distribute Electron app for macOS, Windows and Linux with "auto update" support
out of the box.
## FAQ
To do this, use [electron-builder]:
### MPV is either not working or is rapidly switching between pause/play states
- Using the npm script `compile`: This script is configured to compile the application as quickly as possible. It is not
ready for distribution, it is compiled only for the current platform and is used for debugging.
- Using GitHub Actions: The application is compiled for any platform and ready-to-distribute files are automatically
added as a draft to the GitHub releases page.
First thing to do is check that your MPV binary path is correct. Navigate to the settings page and re-set the path and restart the app. If your issue still isn't resolved, try reinstalling MPV. Known working versions include `v0.35.x` and `v0.36.x`. `v0.34.x` is a known broken version.
### Working with dependencies
### What music servers does Feishin support?
Because the `renderer` works and builds like a _regular web application_, you can only use dependencies that support the
browser or compile to a browser-friendly format.
Feishin supports any music server that implements a [Navidrome](https://www.navidrome.org/) or [Jellyfin](https://jellyfin.org/) API. **Subsonic API is not currently supported**. This will likely be added in [later when the new Subsonic API is decided on](https://support.symfonium.app/t/subsonic-servers-participation/1233).
This means that in the `renderer` you are free to use any frontend dependencies such as Vue, React, lodash, axios and so
on.However, you _CANNOT_ use any native Node.js APIs, such as, `systeminformation`. These APIs are _only_ available in
a Node.js runtime environment and will cause your application to crash if used in the `renderer` layer. Instead, if you
need access to Node.js runtime APIs in your frontend, export a function form the `preload` package.
All dependencies that require Node.js api can be used in
the [`preload` script](https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts).
## Development
#### Expose in main world
Here is an example. Let's say you need to read some data from the file system or database in the renderer.
Built and tested using Node `v16.15.0`.
In the preload context, create a function that reads and returns data. To make the function announced in the preload
available in the render, you usually need to call
the [`electron.contextBridge.exposeInMainWorld`](https://www.electronjs.org/ru/docs/latest/api/context-bridge). However,
this template uses the [unplugin-auto-expose](https://github.com/cawa-93/unplugin-auto-expose) plugin, so you just need
to export the method from the preload. The `exposeInMainWorld` will be called automatically.
This project is built off of [electron-react-boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate) v4.6.0.
```ts
// preload/index.ts
import{readFile}from'node:fs/promises';
## Translation
// Encapsulate types if you use typescript
interfaceUserData{
prop: string
}
This project uses [Weblate](https://hosted.weblate.org/projects/feishin/) for translations. If you would like to contribute, please visit the link and submit a translation.
// Encapsulate all node.js api
// Everything you exported from preload/index.ts may be called in renderer
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.