version/0.4 #1

Merged
lamacchinadesiderante merged 4 commits from version/0.4 into master 2023-01-08 18:21:04 +00:00
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 Redistribution and use in source and binary forms, with or without
of this software and associated documentation files (the "Software"), to deal modification, are permitted provided that the following conditions are met:
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 1. Redistributions of source code must retain the above copyright notice, this
copies or substantial portions of the Software. list of conditions and the following disclaimer.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2. Redistributions in binary form must reproduce the above copyright notice,
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, this list of conditions and the following disclaimer in the documentation
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE and/or other materials provided with the distribution.
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3. Neither the name of the copyright holder nor the names of its
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE contributors may be used to endorse or promote products derived from
SOFTWARE. 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) Un motore di ricerca libri basato su protocollo IPFS.
- add books
- expand file types
# 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) Il progetto è partito come un fork di [Book Searcher](https://github.com/book-searcher-org/book-searcher).
[![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)
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 git clone https://git.lamacchinadesiderante.org/lamacchinadesiderante/millelibri && cd millelibri
wget https://github.com/zlib-searcher/zlib-searcher/releases/download/0.6.0/index_0.6.zip && unzip index_0.6.zip 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 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 Per modificare la parte frontend (React) del progetto, posizionarsi nella cartella `frontend` e lanciare i comandi:
### 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:
``` ```
zlib_searcher_dir npm install
├── index npm run build
│   ├── some index files... npm run dev
│   └── meta.json
└── zlib-searcher
``` ```
### 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 (da riga 22)
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:
``` ```
zlib_searcher_dir // in the example above, it is project root directory. // const downloadLinkFromIPFS = (gateway: string, book: Book) => {
├── index // return (
│   ├── some index files... // `https://${gateway}/ipfs/${book.ipfs_cid}?filename=` +
│   └── meta.json // encodeURIComponent(`${book.title}_${book.author}.${book.extension}`)
└── zlib-searcher // );
// }
``` ```
## Raw data (da riga 91)
We downloaded `libgen` sql and `zlib` sql and exported the necessary data from them.
``` ```
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) 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.
- [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.

View File

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

View File

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

View File

@ -1,12 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Millelibri / zlib searcher</title> <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> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.tsx"></script> <script type="module" src="/src/main.tsx"></script>
</body> </body>
</html> </html>

View File

@ -1,11 +1,11 @@
{ {
"name": "frontend", "name": "frontend",
"private": true, "private": true,
"version": "0.2.0", "version": "0.4.0",
"type": "module", "type": "module",
"repository": "https://github.com/lamacchinadesiderante/millelibri", "repository": "https://git.lamacchinadesiderante.org/lamacchinadesiderante/millelibri",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite --host",
"build": "vite build", "build": "vite build",
"preview": "vite preview" "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 React, { Suspense, useState } from 'react';
import { SkipNavContent, SkipNavLink } from '@chakra-ui/skip-nav'; import { SkipNavContent, SkipNavLink } from '@chakra-ui/skip-nav';
@ -6,7 +6,7 @@ import { Book } from './scripts/searcher';
import BooksView from './components/BooksView'; import BooksView from './components/BooksView';
import ColorModeSwitch from './components/ColorModeSwitch'; import ColorModeSwitch from './components/ColorModeSwitch';
import ExternalLink from './components/ExternalLink'; import ExternalLink from './components/ExternalLink';
import { FaGithub } from 'react-icons/fa'; import { FaGit } from 'react-icons/fa';
import Footer from './components/Footer'; import Footer from './components/Footer';
import Header from './components/Header'; import Header from './components/Header';
import LanguageSwitch from './components/LanguageSwitch'; import LanguageSwitch from './components/LanguageSwitch';
@ -44,13 +44,13 @@ const App: React.FC = () => {
title={t('nav.repository') ?? ''} title={t('nav.repository') ?? ''}
href={repository} href={repository}
variant="ghost" variant="ghost"
icon={<Icon as={FaGithub} boxSize={5} />} icon={<Icon as={FaGit} boxSize={5} />}
/> />
<LanguageSwitch /> <LanguageSwitch />
<ColorModeSwitch /> <ColorModeSwitch />
<Suspense> {/* <Suspense>
<Settings /> <Settings />
</Suspense> </Suspense> */}
</HStack> </HStack>
</Header> </Header>
@ -58,7 +58,8 @@ const App: React.FC = () => {
<Spacer /> <Spacer />
<Footer> <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> </Footer>
</Flex> </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)} onChange={(value) => i18n.changeLanguage(value as string)}
> >
<MenuItemOption value="en">English</MenuItemOption> <MenuItemOption value="en">English</MenuItemOption>
<MenuItemOption value="zh-CN"></MenuItemOption> {/* <MenuItemOption value="zh-CN"></MenuItemOption>
<MenuItemOption value="fr">French</MenuItemOption> <MenuItemOption value="fr">French</MenuItemOption> */}
<MenuItemOption value="it">Italian</MenuItemOption> <MenuItemOption value="it">Italian</MenuItemOption>
</MenuOptionGroup> </MenuOptionGroup>
</MenuList> </MenuList>

View File

@ -182,7 +182,7 @@
"publisher": "Editore", "publisher": "Editore",
"extension": "Estensione", "extension": "Estensione",
"filesize": "Dimensione file", "filesize": "Dimensione file",
"language": "Lingua", "language": "(Seleziona lingua...)",
"year": "Anno", "year": "Anno",
"pages": "Pagina", "pages": "Pagina",
"isbn": "ISBN", "isbn": "ISBN",
@ -225,7 +225,7 @@
"input": "Scrivi..." "input": "Scrivi..."
}, },
"disclaimer": { "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-size: 32px !important;
font-weight: 700 !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(), react(),
process.env.VITE_TAURI === '0' process.env.VITE_TAURI === '0'
? faviconsPlugin({ ? faviconsPlugin({
icons: { favicons: { source: '../crates/zlib-searcher-desktop/icons/icon.png' } } icons: { favicons: { source: './src/assets/favicon/favicon-32x32.png' } }
}) })
: null : null
], ],