{"id":19065575,"url":"https://github.com/caiorss/zhserver","last_synced_at":"2025-09-07T11:31:13.984Z","repository":{"id":90043326,"uuid":"81402951","full_name":"caiorss/zhserver","owner":"caiorss","description":"Haskell Webserver for Zotero reference manager - based on Zotero.","archived":false,"fork":false,"pushed_at":"2018-02-23T22:08:41.000Z","size":1613,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T00:52:46.501Z","etag":null,"topics":["app","application","books","document","education","haskell","http","papers","reference","rest","search","server","zotero"],"latest_commit_sha":null,"homepage":"https://caiorss.github.io/zhserver","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caiorss.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-09T03:07:29.000Z","updated_at":"2024-06-17T03:40:22.000Z","dependencies_parsed_at":"2024-04-21T03:12:47.720Z","dependency_job_id":null,"html_url":"https://github.com/caiorss/zhserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fzhserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fzhserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fzhserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fzhserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caiorss","download_url":"https://codeload.github.com/caiorss/zhserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232206388,"owners_count":18488512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","application","books","document","education","haskell","http","papers","reference","rest","search","server","zotero"],"created_at":"2024-11-09T00:51:08.985Z","updated_at":"2025-01-02T14:15:19.521Z","avatar_url":"https://github.com/caiorss.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE:  ZHServer - Haskell Book shelve Webserver \n#+AUTHOR: Caio Rodrigues \n#+EMAIL:  \u003ccaiorss.rodrigues@gmail.com\u003e\n#+KEYWORKDS: zotero papers docs documents patent search metadata notes haskell database \n#+STARTUP: contents \n\n#+INFOJS_OPT: view:info toc:t ltoc:t ftoc:nil mouse:underline button:nil path:theme/org-info.js\n#+HTML_HEAD: \u003clink href=\"theme/style.css\" rel=\"stylesheet\"\u003e \n\n* User Guide \n** Overview \n\n_Zhserver_ is an application server that provides a json REST API to\ninterface [[https://www.zotero.org/][Zotero]] database and allows multiple users and third party\napps to search documents by collections, tags, author and so on. \n\nDisclaimer: It is still a work in progress.\n\n*Benefits*\n\nFind, classify information, books, magazines, laws, patents, technical\nstandards, web page snapshots and papers fast. \n\n\n*Features*\n\n - Manage collections of documents like pdf files, books, magazines,\n   thesis, papers, patents, technical documentation and any type of\n   file.\n\n - Find documents by author.\n\n - Find documents by collections. Any item or document can belong to\n   multiple collections.\n\n - Find documents by tags.\n\n - Search documents by content, title and tags.\n\n - Single page web application with URLs that can be bookmarked.\n\n - Web Application and REST API.\n\n \n*Screenshots*\n\n#+CAPTION: Display all collections \n[[file:images/collections.png][file:images/collections.png]]\n\n#+CAPTION: Display top subcollections.\n[[file:images/subcollections1.png][file:images/subcollections1.png]]\n\n#+CAPTION: Display subcollections and items of collection 'Embedded Systems'.\n[[file:images/subcollections2.png][file:images/subcollections2.png]]\n\n#+CAPTION: Display all tags\n[[file:images/tags.png][file:images/tags.png]]\n\n#+CAPTION: Display tag items.\n[[file:images/tag-items.png][file:images/tag-items.png]]\n\n#+CAPTION: Display all authors\n[[file:images/authors1.png][file:images/authors1.png]]\n\n#+CAPTION: Display all authors which starts with 'simon'\n[[file:images/authors-all.png]]\n\n#+CAPTION: Display all author's items.\n[[file:images/author-items.png][file:images/author-items.png]]\n\n\n*Repository* \n\n - https://github.com/caiorss/zhserver\n\n*Zhserver Web Site*\n\n - https://caiorss.github.io/zhserver\n\n** Build Instructions \n*** Install Dependencies \n\nInstall system dependencies (Arch Linux)\n\n#+BEGIN_SRC sh\nsudo pacman -S postgresql  extra/postgresql-libs\n#+END_SRC\n\nInstall Haskell dependencies with stack \n\n#+BEGIN_SRC sh \nstack install HDBC-sqlite3\nstack install HDBC-postgresql\nstack install happstack-server\n#+END_SRC\n\nAdditional Dependencies: \n\n - Sqlite to run the demonstration database \n\n - PostgresSQL database server for production \n\n*** Compile \n\n#+BEGIN_SRC sh \n$ stack exec -- ghc --make Server \nLinking Server ...\n#+END_SRC\n*** Run tests \n\nThis server comes with a sample database dump for testing. To test the\nserver just run =$ make run-test= it will create the database\n_testdb/zotero.sqlite_ from the sample sql dump _database/zotero-test.sql_\nThe server will listen the port 8000 and it can be accessed from\nhttp://127.0.0.1:8000 or http://localhost:8000 .\n\n\n#+BEGIN_SRC sh\n  $ make run-test \n  stack exec -- ghc --make -o zhserver.bin src/ZHServer.hs src/Zotero.hs\n  [2 of 2] Compiling Main             ( src/ZHServer.hs, src/ZHServer.o )\n  Linking zhserver.bin ...\n  # stack exec -- ghc src/ZHServer.hs -o bin/ZHServer.bin\n  ./zhserver.bin --conf src/zhserver.conf\n  Server Running\n  ------------------\n#+END_SRC\n\n** Usage \n*** Show Help \n\n#+BEGIN_SRC sh \n  $ ./zhserver.bin \n  Zhserver -- Your cloud book shelve web server\n\n  Commands\n\n    --env                 - Load configuration file from ZHSERVER_CONFIG environment variable\n    --conf \u003cconfig file\u003e  - Load configuration file from \u003cconfig file\u003e\n\n  Start server with all configuration passed through command line\n\n    --params [host] [port] [dbUri] [staticPath] [storagePath]\n\n\n             - [host]        - Hostname like 0.0.0.0 to listen all hosts \n             - [port]        - Port like 8080\n             - [dbUri]       - Database URI\n             - [staticPath]  - Path to server static files like index.html *.js files\n             - [storagePath] - Path to Zotero storage directory\n\n\n#+END_SRC\n\n*** Find the Zotero sqlite database \n\nFind the sqlite databases for testing \n\n#+BEGIN_SRC sh \n$ find ~/.mozilla -name zotero.sqlite\n/home/arch/.mozilla/firefox/dic34vce.default/zotero/zotero.sqlite\n/home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/zotero.sqlite\n#+END_SRC\n\n*** Find storage directory \n\n#+BEGIN_SRC sh \n$ find ~/.mozilla -name 'storage' | grep zotero\n/home/arch/.mozilla/firefox/dic34vce.default/zotero/storage\n/home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/storage\n/home/arch/.mozilla/firefox/mwad0hks.zotero/storage\n\n$ ls /home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/storage | head -n16\n22HUC5F9/\n22NEC2IE/\n236SC55S/\n2372MKGN/\n23K7EW4R/\n24P9755W/\n258V847Q/\n25F3TBCX/\n25HSTF7M/\n267B6WPX/\n26B3KTBR/\n26W3KU88/\n27B9VSG4/\n27ERHSIM/\n27FEX8GN/\n27GZRZ49/\n\n$ ls /home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/storage/267B6WPX\n 3512243057-widgets.js                                           ghosh_cover150.jpg          plusone.js\n'3ZGfnXYPgAVNngtqatUNgAAAABJRU5ErkJggg=='                        gplus-32.png                product.jpg\n anon16-rounded.gif                                              gprofile_button-16.png      s_bottom.png\n b16-rounded.gif                                                 gradients_light.png         share_buttons_20_3.png\n body_gradient_tile_light.png                                    icon18_edit_allbkg.gif      shAutoloader.js\n brand                                                           icon18_email.gif            shCore.js\n cm.002.png                                                      icon18_wrench_allbkg.png    show_ads.js\n combinators-as-sublanguage-of-dsl.css                           icon_delete13.gif           stats-flipper.png\n combinators-as-sublanguage-of-dsl.html                          icon_wikipedia_search.png   s_top.png\n diagram-trans.gif                                               KhUMAAAAAElFTkSuQmCC        triangle_ltr.gif\n'DLgASBKnApgkVgXIkhgKiNKJ005s4gDLbCZBiSxfygAAAABJRU5ErkJggg=='   mobile_share_icons4.png     triangle_open.gif\n favicon.ico                                                     openid16-rounded.gif        untitled\n feed-icon32x32.png                                              photo.jpg\n\n\n$ ls /home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/storage/26B3KTBR/\n'Translatable Finite State Time Machine.pdf'\n\n#+END_SRC\n\n*** Set the configuration file \n\nThe file zotserver.conf stores the server configuration such as port\nand host which the server will listen to, the storage path and the\ndatabase. \n\nExample: \n\n#+BEGIN_SRC sh \nServerConfig {\n               serverPort         = 8000\n             , serverHost         = \"0.0.0.0\"\n             , serverStoragePath  = \"/home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/zotero\" \n             , serverDatabase     = \"sqlite:///home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/zotero.sqlite\"\n             }\n#+END_SRC\n\nThe serverHost variable sets what address the server will listen to: \n \n - 0.0.0.0   - Listen to all hosts\n - 127.0.0.1 - Listen to localhost only \n\nThe serverDatabase variable sets the database used by the server. The\ndatabases Sqlite and Postgres are supported. \n\n - SQlite URI:    \n\n#+BEGIN_SRC text \nsqlite:///home/arch/.mozilla/firefox/mwad0hks.zotero/zotero/zotero.sqlite\n#+END_SRC\n\n - Postgres URI: \n\n#+BEGIN_SRC text \npostgres://postgres@localhost/zotero\n#+END_SRC\n*** Run the server \n**** Run with Configuration file in Environment Variable \n\nPass the configuration file by enviroment variable: \n\n#+BEGIN_SRC sh \n  $ env ZHSERVER_CONFIG=./zhserver.conf ./ZHServer --env \n  Server Running\n  ------------------\n  Loading default configuration file from ZHSERVER_CONFIG environment variable.\n  sqlite://testdb/zotero.sqlite\n  testdb/zotero.sqlite\n\n\n#+END_SRC \n\nor \n\n#+BEGIN_SRC sh \n  $ export ZHSERVER_CONFIG=./zhserver.conf\n\n\n  $ ./ZHServer \n  Server Running\n  ------------------\n  Loading default configuration file from ZHSERVER_CONFIG environment variable.\n  sqlite://testdb/zotero.sqlite\n  testdb/zotero.sqlite\n\n\n#+END_SRC\n\n**** Pass Configuration file by command line:\n\n#+BEGIN_SRC sh \n$ ./ZHServer --conf zhserver.conf \nServer Running\n------------------\nsqlite://testdb/zotero.sqlite\ntestdb/zotero.sqlite\n#+END_SRC\n\n**** Run with all server parameters passed by command line \n\n#+BEGIN_SRC sh \n  $ ./zhserver.bin --params 0.0.0.0 9090 \"sqlite://testdb/zotero.sqlite\" ./assets/ testdb/storage \n  Server Running\n  ------------------\n#+END_SRC\n\n** Documentation \n\n - [[file:Documentation.org][Documentation - Development Notes]] \n\n - [[https://caiorss.github.io/zhserver/docs/index.html][API Documentation]] - Generated by Haddock\n\n** TODO Road map - Tasks \n   \n - [X] Find items by tag\n - [X] Find items by ID\n - [X] Find items by collection\n - [X] Find items by author\n - [X] Navigate through collections hierarchy\n - [X] Display all items with paging.\n - [ ] Find items by a group of authors\n - [ ] Convert database schema from SQLite to Postgres SQL\n - [X] Add logging to the server.\n - [ ] Display all items from a collections, including items from subcollections.\n - [ ] Improve Front End\n - [ ] Improve Web User Interface Functionality\n - [ ] Improve Web User Interface Design \n - [ ] Improve design for mobile devices\n - [ ] Add tag search\n - [ ] Search with multiple tags \n - [ ] Add the database documentation\n - [ ] Add database schema\n - [ ] Add tests\n - [X] Add authentication\n   - Added two authentication options. Basic http authentication or no\n     authentication. \n - [ ] Build a docker to host the server\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiorss%2Fzhserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaiorss%2Fzhserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiorss%2Fzhserver/lists"}