diff --git a/LICENSE b/LICENSE index 8ad8057..1ea5eb6 100644 --- a/LICENSE +++ b/LICENSE @@ -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. \ No newline at end of file diff --git a/README.md b/README.md index 9adaea9..a4b6baf 100644 --- a/README.md +++ b/README.md @@ -1,131 +1,86 @@ -# Millelibri project +# Millelibri -This is a fork from zlib-searcher project. Future goals: +[Logo Millelibri](frontend/src/assets/logo/logo.png) -- 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 + {/* + {ipfsGateways.map((gateway) => ( + + ))} + + */} ``` -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. \ No newline at end of file +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. \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index 41ff789..f898807 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,12 +1,19 @@ - - - - Millelibri / zlib searcher - - -
- - - + + + + + + + + + Millelibri + + + +
+ + + + \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 0a24a3d..f2999c3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,9 +1,9 @@ { "name": "frontend", "private": true, - "version": "0.2.0", + "version": "0.3.0", "type": "module", - "repository": "https://github.com/lamacchinadesiderante/millelibri", + "repository": "https://git.lamacchinadesiderante.org/lamacchinadesiderante/millelibri", "scripts": { "dev": "vite", "build": "vite build", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index b1e748c..3650e45 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -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={} /> - + {/* - + */} @@ -58,7 +58,8 @@ const App: React.FC = () => { ); diff --git a/frontend/src/assets/bg/millelibri_dark_bg_desktop.png b/frontend/src/assets/bg/millelibri_dark_bg_desktop.png new file mode 100644 index 0000000..2865591 Binary files /dev/null and b/frontend/src/assets/bg/millelibri_dark_bg_desktop.png differ diff --git a/frontend/src/assets/bg/millelibri_dark_bg_desktop.png~ b/frontend/src/assets/bg/millelibri_dark_bg_desktop.png~ new file mode 100644 index 0000000..0357eca Binary files /dev/null and b/frontend/src/assets/bg/millelibri_dark_bg_desktop.png~ differ diff --git a/frontend/src/assets/bg/millelibri_dark_bg_mobile.png b/frontend/src/assets/bg/millelibri_dark_bg_mobile.png new file mode 100644 index 0000000..0de7de3 Binary files /dev/null and b/frontend/src/assets/bg/millelibri_dark_bg_mobile.png differ diff --git a/frontend/src/assets/bg/millelibri_dark_bg_mobile.png~ b/frontend/src/assets/bg/millelibri_dark_bg_mobile.png~ new file mode 100644 index 0000000..fcb87e1 Binary files /dev/null and b/frontend/src/assets/bg/millelibri_dark_bg_mobile.png~ differ diff --git a/frontend/src/assets/bg/millelibri_light_bg_desktop.png b/frontend/src/assets/bg/millelibri_light_bg_desktop.png new file mode 100644 index 0000000..fafddb4 Binary files /dev/null and b/frontend/src/assets/bg/millelibri_light_bg_desktop.png differ diff --git a/frontend/src/assets/bg/millelibri_light_bg_desktop.png~ b/frontend/src/assets/bg/millelibri_light_bg_desktop.png~ new file mode 100644 index 0000000..efb9c58 Binary files /dev/null and b/frontend/src/assets/bg/millelibri_light_bg_desktop.png~ differ diff --git a/frontend/src/assets/bg/millelibri_light_bg_mobile.png b/frontend/src/assets/bg/millelibri_light_bg_mobile.png new file mode 100644 index 0000000..39039d3 Binary files /dev/null and b/frontend/src/assets/bg/millelibri_light_bg_mobile.png differ diff --git a/frontend/src/assets/bg/millelibri_light_bg_mobile.png~ b/frontend/src/assets/bg/millelibri_light_bg_mobile.png~ new file mode 100644 index 0000000..b606fd7 Binary files /dev/null and b/frontend/src/assets/bg/millelibri_light_bg_mobile.png~ differ diff --git a/frontend/src/assets/favicon/android-chrome-192x192.png b/frontend/src/assets/favicon/android-chrome-192x192.png new file mode 100644 index 0000000..64de08a Binary files /dev/null and b/frontend/src/assets/favicon/android-chrome-192x192.png differ diff --git a/frontend/src/assets/favicon/android-chrome-512x512.png b/frontend/src/assets/favicon/android-chrome-512x512.png new file mode 100644 index 0000000..9b8525d Binary files /dev/null and b/frontend/src/assets/favicon/android-chrome-512x512.png differ diff --git a/frontend/src/assets/favicon/apple-touch-icon.png b/frontend/src/assets/favicon/apple-touch-icon.png new file mode 100644 index 0000000..911305d Binary files /dev/null and b/frontend/src/assets/favicon/apple-touch-icon.png differ diff --git a/frontend/src/assets/favicon/favicon-16x16.png b/frontend/src/assets/favicon/favicon-16x16.png new file mode 100644 index 0000000..b876ddb Binary files /dev/null and b/frontend/src/assets/favicon/favicon-16x16.png differ diff --git a/frontend/src/assets/favicon/favicon-32x32.png b/frontend/src/assets/favicon/favicon-32x32.png new file mode 100644 index 0000000..58aa572 Binary files /dev/null and b/frontend/src/assets/favicon/favicon-32x32.png differ diff --git a/frontend/src/assets/favicon/favicon.ico b/frontend/src/assets/favicon/favicon.ico new file mode 100644 index 0000000..e2bbc6d Binary files /dev/null and b/frontend/src/assets/favicon/favicon.ico differ diff --git a/frontend/src/assets/favicon/site.webmanifest b/frontend/src/assets/favicon/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/frontend/src/assets/favicon/site.webmanifest @@ -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"} \ No newline at end of file diff --git a/frontend/src/assets/logo/logo.png b/frontend/src/assets/logo/logo.png new file mode 100644 index 0000000..33729f5 Binary files /dev/null and b/frontend/src/assets/logo/logo.png differ diff --git a/frontend/src/components/LanguageSwitch.tsx b/frontend/src/components/LanguageSwitch.tsx index 4bd6b6c..3b129da 100644 --- a/frontend/src/components/LanguageSwitch.tsx +++ b/frontend/src/components/LanguageSwitch.tsx @@ -32,8 +32,8 @@ const LanguageSwitch: React.FC = () => { onChange={(value) => i18n.changeLanguage(value as string)} > English - 简体中文 - French + {/* 简体中文 + French */} Italian diff --git a/frontend/src/i18n.json b/frontend/src/i18n.json index 0dd41ce..6309813 100644 --- a/frontend/src/i18n.json +++ b/frontend/src/i18n.json @@ -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." } } } diff --git a/frontend/src/style.css b/frontend/src/style.css index 9390395..071ec60 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -38,4 +38,28 @@ h1 { font-family: 'Lemon Yellow Sun' !important; 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; + background-attachment: fixed; +} + +body.chakra-ui-dark { + background-image: url("./assets/bg/millelibri_dark_bg_desktop.png"); + background-repeat: no-repeat; + background-position: right bottom; + background-attachment: fixed; +} + +@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"); + } } \ No newline at end of file