Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tiomchik committed Nov 29, 2024
0 parents commit d8607a6
Show file tree
Hide file tree
Showing 1,290 changed files with 10,524 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out/
.webpack
node_modules
.DS_Store
.env
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Tyoma

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Bibleader (RU)

Read the Bible without internet access.

Made with [Electron](https://www.electronjs.org/) and [React](https://reactjs.org/).

![bibleader](./screenshot.jpg)

## Installation

Download and lauch the needed file from the [releases](https://github.com/tiomchik/bibleader/releases) page.

To add this program to the start menu on Linux, you can use [alacarte](https://github.com/GNOME/alacarte).

## Troubleshooting

### The app icon is missing (Linux)

1. Download the [icon](https://github.com/tiomchik/bibleader/tree/main/src/icons/bibleader.png).

2. Copy the icon to the `/usr/share/pixmaps` directory:

```bash
sudo cp bibleader.png /usr/share/pixmaps
```

## Get started (development)

1. Clone the repository:

```bash
git clone https://github.com/tiomchik/bibleader.git
```

2. Install dependencies:

```bash
yarn
# or
npm install
```

3. Run the app:

```bash
yarn start
# or
npm start
```

## Build

```bash
yarn make
# or
npm run make
```

## Contributing

If you encountered with any bugs or you find any errors in the Bible, please, create an issue.

All pull requests are welcome!

## Links

- [Bible in JSON](https://github.com/rkazakov/usfm2json/tree/master/json)
- Icons ([www.flaticon.com](https://www.flaticon.com), [www.svgrepo.com](https://www.svgrepo.com), [icons8.com](https://icons8.com))

## License

Code is licensed under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
60 changes: 60 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import type { ForgeConfig } from "@electron-forge/shared-types";
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
import { MakerZIP } from "@electron-forge/maker-zip";
import { MakerDeb } from "@electron-forge/maker-deb";
import { MakerRpm } from "@electron-forge/maker-rpm";
import { AutoUnpackNativesPlugin } from "@electron-forge/plugin-auto-unpack-natives";
import { WebpackPlugin } from "@electron-forge/plugin-webpack";
import { FusesPlugin } from "@electron-forge/plugin-fuses";
import { FuseV1Options, FuseVersion } from "@electron/fuses";
import MakerAppImage from "electron-forge-maker-appimage";

import { mainConfig } from "./webpack.main.config";
import { rendererConfig } from "./webpack.renderer.config";

const config: ForgeConfig = {
packagerConfig: {
icon: "./src/icons/bibleader",
asar: true,
},
rebuildConfig: {},
makers: [
new MakerSquirrel({ setupIcon: "./src/icons/bibleader.ico" }),
new MakerZIP({}, ["darwin"]),
new MakerRpm({ options: { icon: "./src/icons/bibleader.png" } }),
new MakerDeb({ options: { icon: "./src/icons/bibleader.png" } }),
new MakerAppImage({ options: { icon: "./src/icons/bibleader.png" } }),
],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
html: "./src/index.html",
js: "./src/renderer.tsx",
name: "main_window",
preload: {
js: "./src/preload.ts",
},
},
],
},
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

export default config;
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "bibleader",
"productName": "bibleader",
"version": "1.0.0",
"description": "Read the Bible without internet access",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish"
},
"devDependencies": {
"@electron-forge/cli": "^7.5.0",
"@electron-forge/maker-deb": "^7.5.0",
"@electron-forge/maker-rpm": "^7.5.0",
"@electron-forge/maker-squirrel": "^7.5.0",
"@electron-forge/maker-zip": "^7.5.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.5.0",
"@electron-forge/plugin-fuses": "^7.5.0",
"@electron-forge/plugin-webpack": "^7.5.0",
"@electron/fuses": "^1.8.0",
"@svgr/webpack": "^8.1.0",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@vercel/webpack-asset-relocator-loader": "1.7.3",
"css-loader": "^6.0.0",
"electron": "32.1.2",
"electron-forge-maker-appimage": "https://github.com/Marcus10110/electron-forge-maker-appimage.git",
"fork-ts-checker-webpack-plugin": "^7.2.13",
"node-loader": "^2.0.0",
"sass": "^1.79.4",
"style-loader": "^4.0.0",
"ts-loader": "^9.2.2",
"ts-node": "^10.0.0",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "~4.5.4"
},
"keywords": [
"bible",
"read bible",
"electron"
],
"author": "tyoma",
"license": "MIT",
"dependencies": {
"electron-squirrel-startup": "^1.0.1",
"node-gyp": "^10.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sass-loader": "^16.0.2"
},
"browser": {
"fs": false,
"os": false,
"path": false
}
}
Binary file added screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { useEffect, useState } from "react";
import { HomePage } from "@pages";
import { PageContext } from "@app/contexts";
import { pageShortcuts } from "./shortcuts";

const App: React.FC = () => {
const [page, setPage] = useState<React.JSX.Element>(<HomePage />);

const goToPage = (pageElement: React.JSX.Element): void => {
setPage(pageElement);
};

useEffect(() => {
const handlePageShortcuts = (e: KeyboardEvent) => {
for (const [code, page] of Object.entries(pageShortcuts)) {
if (e.code === code) {
goToPage(page);
}
}
};

addEventListener("keydown", handlePageShortcuts);

return () => {
removeEventListener("keydown", handlePageShortcuts);
};
}, [goToPage]);

return <PageContext.Provider value={goToPage}>{page}</PageContext.Provider>;
};

export default App;
14 changes: 14 additions & 0 deletions src/app/contexts/Bookmark.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Book, Bookmark } from "@app/types";
import { createContext } from "react";

type BookmarkContextType = {
book: Book;
bookmark: Bookmark;
onRemoveBookmark: (bookmark: Bookmark) => void;
};

export const BookmarkContext = createContext({
book: { name: "Genesis", id: "GENESIS" },
bookmark: { bookId: "GENESIS", chapter: 1 },
onRemoveBookmark: (bookmark: Bookmark) => {},
} as BookmarkContextType);
7 changes: 7 additions & 0 deletions src/app/contexts/Chapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createContext } from "react";
import { BookWithChapter } from "@app/types";

export const ChapterContext = createContext({
book: { name: "Genesis", id: "GENESIS" },
chapter: 1,
} as BookWithChapter);
5 changes: 5 additions & 0 deletions src/app/contexts/Page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React, { createContext } from "react";

export const PageContext = createContext(
function goToPage(pageElement: React.JSX.Element) {},
);
3 changes: 3 additions & 0 deletions src/app/contexts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./Chapter";
export * from "./Page";
export * from "./Bookmark";
Loading

0 comments on commit d8607a6

Please sign in to comment.