Merge pull request 'version/0.4' (#1) from version/0.4 into master

Reviewed-on: #1
This commit is contained in:
lamacchinadesiderante 2023-01-08 18:21:04 +00:00
commit ed5ea52618
28 changed files with 141 additions and 148 deletions

41
LICENSE
View File

@ -1,21 +1,28 @@
MIT License
BSD 3-Clause License
Copyright (c) 2022 zlib-searcher's authors
Copyright (c) 2023, The Book Searcher Authors
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:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
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.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

157
README.md
View File

@ -1,131 +1,86 @@
# Millelibri project
# Millelibri
This is a fork from zlib-searcher project. Future goals:
![Logo Millelibri](frontend/src/assets/logo/logo_256px.png?raw=true)
- improve search indexes (language)
- add books
- expand file types
Un motore di ricerca libri basato su protocollo IPFS.
# zlib(libgen) searcher
Una versione funzionante si trova [qui](https://millelibri.lamacchinadesiderante.org).
[![GitHub stars](https://img.shields.io/github/stars/zlib-searcher/zlib-searcher)](https://github.com/zlib-searcher/zlib-searcher/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/zlib-searcher/zlib-searcher)](https://github.com/zlib-searcher/zlib-searcher/network)
[![Release](https://img.shields.io/github/release/zlib-searcher/zlib-searcher)](https://github.com/zlib-searcher/zlib-searcher/releases)
[![GitHub issues](https://img.shields.io/github/issues/zlib-searcher/zlib-searcher)](https://github.com/zlib-searcher/zlib-searcher/issues)
[![GitHub license](https://img.shields.io/github/license/zlib-searcher/zlib-searcher)](https://github.com/zlib-searcher/zlib-searcher/blob/master/LICENSE)
Il progetto è partito come un fork di [Book Searcher](https://github.com/book-searcher-org/book-searcher).
Search `zlib`/`libgen` index to get `ipfs_cid`.
L'obiettivo è trasformarlo in una piattaforma partecipativa: gli utenti avranno la possibilità di richiedere l'aggiunta di libri, oltre a fare ricerche.
We don't save and provide files, we provide search.
## Copyright e pirateria
I hope everyone have a copy of the index locally, so that no need to rely on any centralized service.
Nessun materiale protetto da copyright è ospitato su questo repo.
## Deploy with Docker
Nessun link a materiale protetto da copyright è ospitato su questo repo.
Il motore fa ricerche su degli indici, e fornisce dei risultati.
Non abbiamo nulla contro la pirateria, ma vogliamo evitare di trovarci in situazioni spiacevoli.
Non riusciamo a capire in quali occasioni la condivisione di link esterni a materiale protetto da copyright sia reato e in quali no. Quindi, per tutelarci, abbiamo disabilitato la generazione automatica di link IPFS alle risorse. Tuttavia è possibile riabilitarla modificando il codice sorgente (spiegato sotto).
Viene fornita solo un'informazione parziale. Sta all'utente mettere insieme i pezzi.
## Installazione rapida
E' possibile buildare il progetto via Docker. Occorre avere prima installato e configurato sia Docker che il tool `docker-compose`.
Occorre clonare il repo e il file contenente gli indici dei libri:
```
git clone https://github.com/zlib-searcher/zlib-searcher.git && cd zlib-searcher
wget https://github.com/zlib-searcher/zlib-searcher/releases/download/0.6.0/index_0.6.zip && unzip index_0.6.zip
git clone https://git.lamacchinadesiderante.org/lamacchinadesiderante/millelibri && cd millelibri
wget https://github.com/zlib-searcher/index/releases/download/0.8.0/index_0.8.0.zip && unzip index_0.8.0.zip
docker-compose up -d
```
Now `zlib-searcher` it will listen to `0.0.0.0:7070`.
Il progetto sarà attivo all'indirizzo `localhost:7070`.
## Sviluppo frontend
## Usage
### 1. Download the pre-compiled binary from [Release](https://github.com/zlib-searcher/zlib-searcher/releases).
Or you can compile by yourself. Refer to [Build from source](#build-from-source) for instructions.
### 2. Download the `index` file that has been created.
We will give the corresponding `index` download links for each version in the release page.
Or you can make your own via `zlib-searcher index`.
Extract the `index` folder to the same level as the program, it should look like the following:
Per modificare la parte frontend (React) del progetto, posizionarsi nella cartella `frontend` e lanciare i comandi:
```
zlib_searcher_dir
├── index
│   ├── some index files...
│   └── meta.json
└── zlib-searcher
npm install
npm run build
npm run dev
```
### 3. Run `zlib-searcher run`, it will listen to `127.0.0.1:7070`.
## Riabilitare la generazione dei link IPFS
Access http://127.0.0.1:7070/ to use webui, or you can use the original api.
Per riabilitare i bottoni/link ai Gateway IPFS, aprire il file `frontend/src/components/BooksDetailsCard.tsx` e de-commentare le seguenti linee di codice:
#### original search api
You can search by the following fields:
- title
- author
- publisher
- extension
- language
- isbn
- zlib_id
Examples:
- `http://127.0.0.1:7070/search?limit=30&query=余华`
- `http://127.0.0.1:7070/search?limit=30&query=title:机器学习 extension:azw3 publisher:清华`
- `http://127.0.0.1:7070/search?limit=30&query=zlib_id:18557063`
- `http://127.0.0.1:7070/search?limit=30&query=isbn:9787302423287`
## Build from source
### 1. Build `zlib-searcher`
First build frontend
```bash
make frontend_preinstall frontend
```
Then build zlib-searcher
```bash
TARGET=release make
# move the compiled binary to the project root directory
mv target/release/zlib-searcher .
```
### 2. Build `index`
Download `zlib_index_books.csv.zip` and `libgen_index_books.csv.zip` and extract the `csv` files to the project root directory.
Then run `zlib-searcher index`. You may need to `rm index/*` first.
If you have other csv files, you can run `zlib-searcher index -f *.csv` to index them.
The finally folder structure should look like this:
(da riga 22)
```
zlib_searcher_dir // in the example above, it is project root directory.
├── index
│   ├── some index files...
│   └── meta.json
└── zlib-searcher
// const downloadLinkFromIPFS = (gateway: string, book: Book) => {
// return (
// `https://${gateway}/ipfs/${book.ipfs_cid}?filename=` +
// encodeURIComponent(`${book.title}_${book.author}.${book.extension}`)
// );
// }
```
## Raw data
We downloaded `libgen` sql and `zlib` sql and exported the necessary data from them.
(da riga 91)
```
id, title, author, publisher, extension, filesize, language, year, pages, isbn, ipfs_cid
{/* <SimpleGrid columns={{ sm: 2, md: 3, lg: 4, xl: 5 }} spacing={{ base: 2, md: 4 }}>
{ipfsGateways.map((gateway) => (
<Button
as={ExternalLink}
href={downloadLinkFromIPFS(gateway, row.original)}
key={gateway}
variant="outline"
>
{gateway}
</Button>
))}
</SimpleGrid> */}
```
This raw data is used to generate our `index`, you can download the raw data from here:
## Licenza
- [zlib_index_books.csv.zip](https://github.com/zlib-searcher/zlib-searcher/releases/download/0.4.0/zlib_index_books.csv.zip)
- [libgen_index_books.csv.zip](https://github.com/zlib-searcher/zlib-searcher/releases/download/0.4.0/libgen_index_books.csv.zip)
## License
**zlib-searcher** © [zlib-searcher's authors](https://github.com/zlib-searcher/zlib-searcher/graphs/contributors), Released under the [MIT](./LICENSE) License.
Book Searcher è rilasciato sotto licenza [BSD-3-Clause](https://github.com/book-searcher-org/book-searcher/blob/master/LICENSE). Millelibri eredita la licenza da Book Searcher.

View File

@ -28,11 +28,11 @@
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"../../frontend/src/assets/favicon/favicon-32x32.png",
"../../frontend/src/assets/favicon/android-chrome-512x512.png",
"../../frontend/src/assets/favicon/android-chrome-512x512.png",
"icons/icon.icns",
"icons/icon.ico"
"../../frontend/src/assets/favicon/favicon.ico"
],
"identifier": "com.github.zlib-searcher",
"longDescription": "",

View File

@ -2,9 +2,9 @@ version: '3'
services:
zlib:
image: lamacchinadesiderante/millelibri:latest
# image: lamacchinadesiderante/millelibri:latest
# image: millelibri:v0.2
image: millelibri:v0.4
# image: millelibri

View File

@ -1,12 +1,19 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Millelibri / zlib searcher</title>
</head>
<body>
<link rel="apple-touch-icon" sizes="180x180" href="/src/assets/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/src/assets/favicon//favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/src/assets/favicon/favicon-16x16.png">
<link rel="manifest" href="/src/assets/favicon/site.webmanifest">
<title>Millelibri</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</body>
</html>

View File

@ -1,11 +1,11 @@
{
"name": "frontend",
"private": true,
"version": "0.2.0",
"version": "0.4.0",
"type": "module",
"repository": "https://github.com/lamacchinadesiderante/millelibri",
"repository": "https://git.lamacchinadesiderante.org/lamacchinadesiderante/millelibri",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "vite build",
"preview": "vite preview"
},

View File

@ -1,4 +1,4 @@
import { Flex, HStack, Icon, IconButton, Spacer } from '@chakra-ui/react';
import { Flex, HStack, Icon, IconButton, Link, Spacer, Text } from '@chakra-ui/react';
import React, { Suspense, useState } from 'react';
import { SkipNavContent, SkipNavLink } from '@chakra-ui/skip-nav';
@ -6,7 +6,7 @@ import { Book } from './scripts/searcher';
import BooksView from './components/BooksView';
import ColorModeSwitch from './components/ColorModeSwitch';
import ExternalLink from './components/ExternalLink';
import { FaGithub } from 'react-icons/fa';
import { FaGit } from 'react-icons/fa';
import Footer from './components/Footer';
import Header from './components/Header';
import LanguageSwitch from './components/LanguageSwitch';
@ -44,13 +44,13 @@ const App: React.FC = () => {
title={t('nav.repository') ?? ''}
href={repository}
variant="ghost"
icon={<Icon as={FaGithub} boxSize={5} />}
icon={<Icon as={FaGit} boxSize={5} />}
/>
<LanguageSwitch />
<ColorModeSwitch />
<Suspense>
{/* <Suspense>
<Settings />
</Suspense>
</Suspense> */}
</HStack>
</Header>
@ -58,7 +58,8 @@ const App: React.FC = () => {
<Spacer />
<Footer>
<a href='https://www.lamacchinadesiderante.org'>lamacchinadesiderante.org</a>
<Link href='https://www.lamacchinadesiderante.org' isExternal>lamacchinadesiderante.org</Link>
<Text fontSize='xs'>powered by Book Searcher</Text>
</Footer>
</Flex>
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -32,8 +32,8 @@ const LanguageSwitch: React.FC = () => {
onChange={(value) => i18n.changeLanguage(value as string)}
>
<MenuItemOption value="en">English</MenuItemOption>
<MenuItemOption value="zh-CN"></MenuItemOption>
<MenuItemOption value="fr">French</MenuItemOption>
{/* <MenuItemOption value="zh-CN"></MenuItemOption>
<MenuItemOption value="fr">French</MenuItemOption> */}
<MenuItemOption value="it">Italian</MenuItemOption>
</MenuOptionGroup>
</MenuList>

View File

@ -182,7 +182,7 @@
"publisher": "Editore",
"extension": "Estensione",
"filesize": "Dimensione file",
"language": "Lingua",
"language": "(Seleziona lingua...)",
"year": "Anno",
"pages": "Pagina",
"isbn": "ISBN",
@ -225,7 +225,7 @@
"input": "Scrivi..."
},
"disclaimer": {
"nolink_warning": "IMPORTANTE: Questa piattaforma non ospita nessun tipo di link a materiale protetto da copyright. Solo CID relativi a risorse IPFS."
"nolink_warning": "IMPORTANTE: Questa piattaforma non ospita nessun tipo di link a materiale protetto da copyright. Vengono mostrati solamente CID relativi a risorse IPFS."
}
}
}

View File

@ -39,3 +39,25 @@ h1 {
font-size: 32px !important;
font-weight: 700 !important;
}
body.chakra-ui-light {
background-image: url("./assets/bg/millelibri_light_bg_desktop.png");
background-repeat: no-repeat;
background-position: right bottom;
}
body.chakra-ui-dark {
background-image: url("./assets/bg/millelibri_dark_bg_desktop.png");
background-repeat: no-repeat;
background-position: right bottom;
}
@media (max-width : 899px) {
body.chakra-ui-light {
background-image: url("./assets/bg/millelibri_light_bg_mobile.png");
}
body.chakra-ui-dark {
background-image: url("./assets/bg/millelibri_dark_bg_mobile.png");
}
}

View File

@ -17,7 +17,7 @@ export default defineConfig(() => {
react(),
process.env.VITE_TAURI === '0'
? faviconsPlugin({
icons: { favicons: { source: '../crates/zlib-searcher-desktop/icons/icon.png' } }
icons: { favicons: { source: './src/assets/favicon/favicon-32x32.png' } }
})
: null
],