Giter Club home page Giter Club logo

nanawel / our-shopping-list Goto Github PK

View Code? Open in Web Editor NEW
70.0 4.0 7.0 3.89 MB

OSL is a simple shared list web-application based on Node and VueJS. Typical uses include shopping lists of course, and any other small todo-list that needs to be used collaboratively.

License: GNU Affero General Public License v3.0

Shell 0.20% Dockerfile 0.85% Makefile 0.88% JavaScript 59.12% HTML 1.05% Vue 37.89%
todolist pwa collaborative websocket mongodb vuejs nodejs

our-shopping-list's Introduction

OSL logo

Our Shopping List

OSL is a simple shared list application. Typical uses include shopping lists of course, and any other small todo-list that needs to be used collaboratively.

The current implementation provides the following features:

  • Multiple boards (can be disabled, see VUE_APP_SINGLEBOARD_MODE)
  • Each board with multiple lists
  • Real-time sync between users
  • Items with the following fields: name, quantity, details
  • Checkable items
  • 2 display modes for items (unchecked only / checked only, sorted by check time)
  • Intuitive search
  • Mobile-first UI with swipeable items
  • PWA basic support
  • Partial internationalisation (i18n)
    • Only EN and FR languages are available at that time, but PR are welcome for more! See examples here.

But, at this date it lacks the following:

  • Full PWA support with offline mode and deferred sync

⭐ New in v2: Boards feature

Before v2, all of the lists on an instance were available to all users.

Version 2 introduces a new feature called "boards". It's simply a way to group lists together under a common name. That name can then be shared so that people use the lists from a board collaboratively.

But, you might want to disable that feature and keep using a unique board for your whole instance. In that case, just use the provided VUE_APP_SINGLEBOARD_MODE environment variable.

But have no fear, you can always:

  • Switch from singleboard mode to multi-board
    • In that case you'll have to create a new board and choose it as target for existing lists with the provided CLI tool.
  • Switch from multi-board mode to singleboard
    • In that case you can choose which lists to migrate to the special unique board, but you'll lose access to all other lists (they are not deleted, just not accessible anymore)

See next § for instructions on how to enable one mode or the other.

☝ Instructions when migrating from v1 to v2

Version 2 has added the multiboard feature which changes the default mode the application runs into.

If you already had a working v1, and would like to upgrade to v2 please follow the steps below:

Back up your data before proceeding!

If you want to keep using one single board on your instance (just like on v1)

  • Make sure you set the VUE_APP_SINGLEBOARD_MODE to 1
  • Once started, use the CLI to migrate existing lists to the special board used as common parent for lists in "singleboard" mode.
    docker-compose exec app node cli.js board:create --singleboard
    docker-compose exec app node cli.js list:move-to-board --all --singleboard
  • Use the application as usual (you might have to clear your browser's cache to make sure there's no invalid data left).

If you want to enable the new boards feature and migrate your existing lists to a dedicated board

  • Make sure VUE_APP_SINGLEBOARD_MODE is not set or set to 0
  • Create a new board with the name of your choice
    # Get the created board's slug from the output and use it in the following command
    docker-compose exec app node cli.js board:create my-board
    docker-compose exec app node cli.js list:move-to-board --all --board my-board
  • Open the application, and from the home screen open the board you've just created to find your lists.

🖼 Screenshots

Mobile

☝ Screenshots are from v1, but v2 looks mostly the same.

Click here to see more!

Desktop

☝ Screenshots are from v1, but v2 looks mostly the same.

Click here to see more!

📦 Installation

🐋 With Docker

With a running MongoDB 4.x container as mymongo on the host:

docker run --detach \
  --name our-shopping-list \
  --link mymongo:mongodb \
  --publish 80:8080 \
  ourshoppinglist/our-shopping-list

🐋 With docker-compose

Use the provided docker-compose.yml and adapt it to your needs.

Then to start the containers:

docker-compose up -d

Available environment variables for the app container

  • System keys

    • LISTEN_PORT (default: 8080)
    • MONGODB_HOST (default: mongodb)
    • MONGODB_PORT (default: 27017)
    • MONGODB_DB (default: osl)
    • BASE_URL (default: empty) Set to base path if your web root is not / (ex: /my-osl/)

    MongoDB authentication is not supported yet.

  • Application keys

    • VUE_APP_APM_ENABLED (default: 0) Reference
    • VUE_APP_APM_LOGLEVEL (default: warn) Reference
    • VUE_APP_APM_SERVERURL (default: http://localhost:8200) Reference
    • VUE_APP_APM_SERVERURLPREFIX (default: /intake/v${apiVersion}/rum/events) Reference
    • VUE_APP_APM_SERVICENAME Reference
    • VUE_APP_BOARD_DELETION_ENABLED (default: 0) Reference
    • VUE_APP_CHECKED_ITEMS_HISTORY_SORT_FIELD (default: lastCheckedAt, see available fields here)
    • VUE_APP_CHECKED_ITEMS_HISTORY_SORT_ORDER (default: desc)
    • VUE_APP_CLIENT_LOG_CONSOLE_ENABLED (default: false, see doc here)
    • VUE_APP_CLIENT_LOG_ENABLED (default: false, see doc here)
    • VUE_APP_CLIENT_LOG_LEVEL (default: debug)
    • VUE_APP_EDIT_ITEM_ON_CREATE (default: 0)
    • VUE_APP_HOME_MESSAGE (default: empty)
    • VUE_APP_I18N_FALLBACK_LOCALE (default: en)
    • VUE_APP_I18N_FORCE_LOCALE (default: 0)
    • VUE_APP_I18N_LOCALE (default: en)
    • VUE_APP_LIST_ALL_BOARDS_ENABLED (default: 0, has no effect in singleboard mode)
    • VUE_APP_LOCALSTORAGE_KEY_PREFIX (default: OurShoppingList_)
    • VUE_APP_SHORT_TITLE (default: OSL)
    • VUE_APP_SINGLEBOARD_MODE (default: 0)
    • VUE_APP_TITLE (default: Our Shopping List)
    • VUE_APP_USE_ITEM_QUICK_SYNTAX (default: 0) Reference

Robots.txt

By default, the embedded robots.txt prevents search engines from browsing the application:

User-agent: *
Disallow: /

You can change this behavior by mounting the robots.txt of your choice at /app/robots.txt in the container.

🗒 Notes for reverse-proxy (SSL offloading)

OSL uses a WebSocket to allow server-to-client communication. So using a reverse-proxy to forward the connection implies the presence of the following sections below in the corresponding virtual host.

Replace 127.0.0.1 and 8080 with the IP of the OSL host if your RP is not the host itself and/or if you're using another port.

Apache

<Proxy *>
    Allow from all
</Proxy>
ProxyPass         /  http://127.0.0.1:8080/
ProxyPassReverse  /  http://127.0.0.1:8080/
ProxyPreserveHost On

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*)           ws://127.0.0.1:8080/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*)           http://127.0.0.1:8080/$1 [P,L]

Nginx

location / {
    proxy_set_header    Host $host;
    proxy_set_header    X-Real-IP $remote_addr;
    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto $scheme;
    proxy_pass          http://localhost:8080;

    proxy_http_version  1.1;
    proxy_set_header    Upgrade $http_upgrade;
    proxy_set_header    Connection "Upgrade";
    
    proxy_redirect      http://localhost:8080 https://ourshoppinglist.myhost;
}

⚠ Notes when serving multiple instances on different web roots

Remember to set the BASE_URL variable to the matching web root on each instance.

Make sure you set VUE_APP_LOCALSTORAGE_KEY_PREFIX to a unique value too, otherwise clients switching from one instance to another might corrupt the internal cache in their browser.

Example:

Debugging on server side

You can use the standard DEBUG environment variable to enable the verbose mode of the server:

Example to log all operations related to socket-io (WebSocket) and the URL rewrite process (when using a custom BASE_URL):

DEBUG=socket.io:server,express-urlrewrite

Or if you need to log everything:

DEBUG=*

👷 Developer installation

🐋 This method also uses Docker, but with the local source files mounted into the node container.

First of all, clone this project in the directory of your choice. Then from it:

make dev-pull
make dev-init
make dev-upd

Now start the Webpack Development Server with

make dev-watch

If you don't, you'll get 504 errors in the console on /sockjs-node/* requests and you won't get hot reloading on changes.

If you want to enter the container, just use

make dev-shell

Special cases

In development mode, the service worker is not enabled. To workaround this limitation, you may want to ponctually build the JS bundle in "production" mode.

Here's how:

make dev-shell

cd client/
NODE_ENV=production yarn build

Then reload the page in your browser and the SW should be activated. You have to make sure you are running the app with TLS enabled. Use the ENABLE_TLS variable to use the embedded TLS proxy if needed.

our-shopping-list's People

Contributors

5mikachu avatar ariaph avatar comradekingu avatar dejavumoe avatar koeberlue avatar nanawel avatar trattaa avatar yarons avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

our-shopping-list's Issues

Remote access question

Hi.
I like the look of this thanks.
Is it possible to remotely add and delete items from the list and also retrieve the contents of the lists but not through the Web UI ?
Sorry I'm new to Docker but I run Home assistant which gives me the ability to send mobile notifications when someone is in a area so I would like it to send the contents of this list if we were in a supermarket.
Thanks

Add an API

Hello,

it would be useful to add an API to OSL.

My use-case:
I am using Mealie for recipe management and want to import the shopping list to OSL.
Currently i am using a script to add entries directly into the MongoDB.
It would be more convenient to be able to use an API to add, modify or delete entries tho.

Thank you for your efforts.

feat: quantity input detection

It would be sensible to allow for a sort of rich input detection using a specific syntax to detect quantity, avoiding the extra step of creating an entry only to then edit it.
I'd suggest something like
2x Toast
in order to create an entry called Toast with the quantity set to 2.

Ideally this would be a settings that one can enable on a per list or maybe per board basis.

Allow configuration of web root

Hello,
I would like to be able to reach OSL via something like https://myserver/osl/ rather than having to configure a different hostname for this service or a different port.
I have tried creating clever nginx reverse proxy rules to achieve this by rewriting the contents of all the source files before they are served to the clients. This has been a bunch of work and still doesn't support every necessary function.
It would be great if this could be added as a configuration parameter, where you can configure the webroot yourself. For example to "osl".
I hope this would not be too difficult to do.
Thanks for this great project. We have been using it for the last months and it is exactly what I was looking for: A lightweight app, that we can use to coordinate our in-store shopping and planning.

Allow changing page title

It would be nice to have a docker environment variable to be able to change the page's title from "Our Shopping List".

It's interesting on desktop to be able to change the tab's title to find it faster but on mobile it's also used by Firefox (and doesn't seem to be editable on Android) to set the app name when installing it from the browser (and the default name is long enough to always be truncated on the home screen)

Allow custom sorting

User story

As someone going shopping I would like to sort the shopping list manually to pre-plan my shopping trip and prevent scrolling through the list while shopping.

Background

When I create a shopping list I tend to order all entries by the approximate order I will find them in the store. So for example our local ALDI has the vegetables near the entry and dairies closer to the exit. I would then like to order my list like this:

  • zucchini
  • carrots
  • milk
  • butter

Feature Request: Add user authentication

Hello,

I just came across your project and it is just perfect. I'm looking for a simple and intuitive interface so that any member of my family can add items to the grocery list without difficulty (otherwise they simply won't use it).

I was going to install it on my development server, but noticed that there was no authentication to access the site. Unfortunately for me it is a necessity since I intend to expose the application on the internet. And I don't want anyone (o ther than my family) to be able to see/edit my listings. (And I also don't want to manage VPN connections on all my family member phones)

Ideally, having users with shared and private lists would be ideal. But, a simple authentication to protect the site would be good enough.

If you put that in place, I could confidently use the project for my family needs.

FYI, I have a MagicMirror² at my house and would like to display somes of my lists on it. So I will probably create a module for our shopping list. I took a quick look at the backend code, and all the endpoints I'll need are already available.

What do you think ?

Healthcheck broken with custom base url

Hi,

I think there is still a small bug in the implementation of the base url feature. Apparently it also changes the base url in the health check url. (at least that is what I am assuming)
This url wasn't and can't be adjusted in the dockerfile. So I guess the healthcheck url needs to still work without the base url.
I guess this means that you cannot use that same url for health checks from outside of the container? But that sounds like a niche use case anyways.

I can see this line in the logs:
[400] Invalid incoming request URL: GET /healthcheck

Hope this isn't too big of fix.
Cheers!

Can't add item using mobile view

When using the app on mobile, I can't see the block to add a new item. Screenshot below. Everything else works fine. Any idea on how to fix this ?

IMG_20221202_113529

Feature request - anonymous lists

Hello I tried out the shopping list and it's great and simple.
Instead of a user concept how about a simple approach with sort of one time lists.
So what I'm trying to say is what are your thoughts about not showing all lists at the front and when you create a list you have the possibility to share the list.

mongodb issue

I have an issue with mongodb appearing randomly and causing Our Shopping List to malfunction. See the screenshot. I'm using the Docker version. I can note many requests in my pihole which do not appear normally.
osl_mongodb

arm8 docker buid?

Would it be possible to have an arm8 version of our-shopping-list?

Allow Boards to be deleted

V2 allows creating multiple boards, but there doesn't seem to be any straightforward way to delete existing boards once they are no longer useful.

An option, ideally in the frontend, to delete Boards would be useful. Ideally this option should ask for a confirmation before actually deleting the board.

Add helm chart

User Story

As the person responsible for hosting our shopping list for my family I would love to have a helm chart available, so that I can deploy this application easily on a kubernetes cluster.

Additional Info

  • helm provides an easy way to deploy applications on a kubernetes cluster
  • It would be possible to add a helm chart for mongodb as a dependency. This would reduce the complexity of this chart

List all boards

Would it be possible to list all the current boards on main page?

BTW, I really love this app! It does one thing and it does it really well! 👏

Caldav support

Hi,

Thanks for this nice software !
As a feature request, I suggest to implement a caldav support, to be able to connect "our-shopping-list" to the nextcloud caldav server, or any caldav-compatible server. Caldav is a widely used opensource protocol (see for instance Tasks - Android, Nextcloud, SoGo, etc.).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.