dh1011 / subscription-manager

A simple web app to help you keep track of your subscriptions and manage your expenses.
MIT License
127 stars 5 forks source link

Support for multiple currencies #2

Open stauffenberg2020 opened 2 weeks ago

stauffenberg2020 commented 2 weeks ago

In addition to having the flexibility to choose different currency symbols, Can a feature to monitor the subscriptions in multiple currencies altogether be added?

RikudouGoku commented 2 weeks ago

Would like that as well, or if it is not possible to have multiple at once, at least being able to change the currency would be great.

vuminhtuanhvtc commented 2 weeks ago

True, it's great if there is an option to create and choose currency as well as their exchange rate

dh1011 commented 2 weeks ago

Thanks for the suggestion, everyone!

I'm a bit unsure about adding an exchange rate feature since rates change constantly, and it would mean relying on an API service. Plus, for tracking subscriptions, I'm not sure how often the exchange rate feature would actually be needed. But do feel free to fork and give it a go!

I agree with the need to have different currency symbol since user can live in different countries. I’ve added support for different currency symbols. You can try this out in the feature/currency branch.

RikudouGoku commented 2 weeks ago

Thanks for the suggestion, everyone!

I'm a bit unsure about adding an exchange rate feature since rates change constantly, and it would mean relying on an API service. Plus, for tracking subscriptions, I'm not sure how often the exchange rate feature would actually be needed. But do feel free to fork and give it a go!

I agree with the need to have different currency symbol since user can live in different countries. I’ve added support for different currency symbols. You can try this out in the feature/currency branch.

I am not sure how to update my docker container to that version? I followed this guide for my Synology nas. https://mariushosting.com/how-to-install-subscription-manager-on-your-synology-nas/

dh1011 commented 2 weeks ago

Hi @RikudouGoku,

I have pushed the Docker image for this branch to dh1011/subscription-manager

You just need to replace dh1011/subscription-manager:1.0.0 with dh1011/subscription-manager:currency in the docker-compose.yml file, and it should work.

RikudouGoku commented 2 weeks ago

Hi @RikudouGoku,

I have pushed the Docker image for this branch to dh1011/subscription-manager

You just need to replace dh1011/subscription-manager:1.0.0 with dh1011/subscription-manager:currency in the docker-compose.yml file, and it should work.

Thanks, that works.

I did notice a bug (?). image

I already had an existing subscription before I updated, I changed the currency settings to euro and everything changes except as you can see on the picture. And adding a new subscription does not change the USD icon either.

dh1011 commented 2 weeks ago

Hi @RikudouGoku Yes, there is a bug where the currency symbol changes in the Summary and Detail Summaries sections, but not in the Subscription List. I have pushed the fix for this issue to the same image.

stauffenberg2020 commented 2 weeks ago

Hi @dh1011, Thanks for this update - But I dont think this is what I intended.

Can a feature to monitor the subscriptions in multiple currencies altogether be added?

This means, People living in continental Europe sometimes have to subscribe some services to the larger Euro currency and some other services to other European sibling currencies like CHF (Swiss Franks), DKK (Danish Krone), SEK (Swedish Krone), NOK (Norwegian Krone) and some other currencies in the Eastern European regions (Zloty, Lira, etc). The closer you are to the border, the probability of subscribing to multiple currencies increases.

And not to forget, Sometimes we have some services that we need to subscribe only based on USD.

The idea behind this request is to assign a different currency to each of the subscriptions and give multiple totals correspondong to each of currency.

I hope it is clear, But please write back if the request is not clear.

RikudouGoku commented 2 weeks ago

Hi @dh1011, Thanks for this update - But I dont think this is what I intended.

Can a feature to monitor the subscriptions in multiple currencies altogether be added?

This means, People living in continental Europe sometimes have to subscribe some services to the larger Euro currency and some other services to other European sibling currencies like CHF (Swiss Franks), DKK (Danish Krone), SEK (Swedish Krone), NOK (Norwegian Krone) and some other currencies in the Eastern European regions (Zloty, Lira, etc). The closer you are to the border, the probability of subscribing to multiple currencies increases.

And not to forget, Sometimes we have some services that we need to subscribe only based on USD.

The idea behind this request is to assign a different currency to each of the subscriptions and give multiple totals correspondong to each of currency.

I hope it is clear, But please write back if the request is not clear.

I believe they got what you meant.

I'm a bit unsure about adding an exchange rate feature since rates change constantly, and it would mean relying on an API service. Plus, for tracking subscriptions, I'm not sure how often the exchange rate feature would actually be needed.

Hi @RikudouGoku Yes, there is a bug where the currency symbol changes in the Summary and Detail Summaries sections, but not in the Subscription List. I have pushed the fix for this issue to the same image.

Confirm it has been fixed now. Did not need to anything else other than update the image and the existing subscription was changed to the Euro symbol now.

dh1011 commented 1 week ago

Hi @stauffenberg2020,

I understand what you mean. Initially, I wasn't sure about the use case for having a different currency for each individual subscription, but I can see it now. Thank you for the clarification.

I've implemented support for this feature, which you can find in the Docker image: dh1011/subscription-manager:currency-exchange-rate.

One tricky aspect is that you'll need an API service to provide live exchange rates since these fluctuate frequently. I found Open Exchange Rates to be quite reliable, and they offer a free service for up to 1000 requests per month.

You'll need to sign up for an account to get their App ID key and then use the new menu to set it up.

image

RikudouGoku commented 1 week ago

I've implemented support for this feature, which you can find in the Docker image: dh1011/subscription-manager:currency-exchange-rate.

One tricky aspect is that you'll need an API service to provide live exchange rates since these fluctuate frequently. I found Open Exchange Rates to be quite reliable, and they offer a free service for up to 1000 requests per month.

You'll need to sign up for an account to get their App ID key and then use the new menu to set it up.

image image

Clicking on the save button doesnt do anything for me. Is it perhaps because you need https access? My NAS which I am running this container on only has LAN access. (Although I can for example use browser docker containers without issue.)

image And here are 2 bugs. Looks like the USD symbol is still there on the subscription list and some weirdness going on with the summary.

Yes, there is a bug where the currency symbol changes in the Summary and Detail Summaries sections, but not in the Subscription List. I have pushed the fix for this issue to the same image.

I can at least confirm that this fixed the subscription list bug in the currency image.

EDIT: image

Looks like the subscription list is fine, I just needed to go and change the currency in the existing subscription and it is fixed now.

EDIT 2: [0] Error saving Open Exchange Rates API key: [Error: ENOENT: no such file or directory, open '.env'] {

[0] errno: -2,

[0] code: 'ENOENT',

[0] syscall: 'open',

[0] path: '.env'

[0] }

Is what I get in the logs on Portainer.

stauffenberg2020 commented 1 week ago

One tricky aspect is that you'll need an API service to provide live exchange rates since these fluctuate frequently. I found Open Exchange Rates to be quite reliable, and they offer a free service for up to 1000 requests per month.

You'll need to sign up for an account to get their App ID key and then use the new menu to set it up.

Hi @dh1011, Thanks for implementing this feature. However I am surprised about the above. I do not expect it to do the currency conversion for me as it is dynamic. I would only expect it to give me number of totals corresponding to each of the currencies, For eg, a total 300 Euros per month and also a total of 600 DKK per month

RikudouGoku commented 1 week ago

One tricky aspect is that you'll need an API service to provide live exchange rates since these fluctuate frequently. I found Open Exchange Rates to be quite reliable, and they offer a free service for up to 1000 requests per month. You'll need to sign up for an account to get their App ID key and then use the new menu to set it up.

Hi @dh1011, Thanks for implementing this feature. However I am surprised about the above. I do not expect it to do the currency conversion for me as it is dynamic. I would only expect it to give me number of totals corresponding to each of the currencies, For eg, a total 300 Euros per month and also a total of 600 DKK per month

Oh I took your request the same as @dh1011 did that you wanted to combine both into one sum that also needs conversion. But this would certainly not need any API services to do and I guess should be easy to implement for @dh1011

vuminhtuanhvtc commented 1 week ago

Hi @dh1011

I've encountered a bug related to the currency conversion in the "Detail Summaries" section of the software. I have a subscription that costs 23.99 TRY/month. When I set the "Detail Summaries" to display in USD, it incorrectly shows 23.99 USD/month instead of converting the amount from TRY to USD.

Additionally, I have registered an account on Open Exchange Rates and obtained a valid API key. However, after monitoring, I have not noticed any requests being made to Open Exchange Rates from the software.

Could you please look into this issue?

Thanks!

dh1011 commented 1 week ago

@stauffenberg2020

One tricky aspect is that you'll need an API service to provide live exchange rates since these fluctuate frequently. I found Open Exchange Rates to be quite reliable, and they offer a free service for up to 1000 requests per month. You'll need to sign up for an account to get their App ID key and then use the new menu to set it up.

Hi @dh1011, Thanks for implementing this feature. However I am surprised about the above. I do not expect it to do the currency conversion for me as it is dynamic. I would only expect it to give me number of totals corresponding to each of the currencies, For eg, a total 300 Euros per month and also a total of 600 DKK per month

Oh, I think I could see what you’re getting at now. Would you mind trying out the image dh1011/subscription-manager:multiple-currencies? It might be closer to what you’re looking for.

stauffenberg2020 commented 1 week ago

Oh, I think I could see what you’re getting at now. Would you mind trying out the image dh1011/subscription-manager:multiple-currencies? It might be closer to what you’re looking for.

Yes, this is what I was expecting. However I noticed three bugs until now

  1. Editing an existing subscription adds a new one
  2. Unable to delete existing subscription
  3. Unable to add icons (Not sure if I am using it properly)
dh1011 commented 1 week ago

@stauffenberg2020 That’s interesting! I’m not experiencing any of the issues you mentioned on my end. It’s possible that your existing database hasn’t been migrated correctly. I’ve pushed the update to the same Docker image, dh1011/subscription-manager:multiple-currencies, which includes the necessary migration, so it should work seamlessly with your existing subscriptions.

As for the icon, browse through your options at Font Awesome. Once you find one you like, just copy and paste the font name into the textbox.

stauffenberg2020 commented 6 days ago

HI @dh1011 ,I am not sure. I tried to use a blank database with the updated image and I am still unable to edit or delete the subscriptions after I have added.

When I edit,

I change the click edit on an existing subscription, I change the recurrence interval and then I dont see an option for update, I only see the button as "Add". When I click that it simply adds another subscription.

And the delete button on the overview page doesnt work for me.

Additionally, When I try to reverse-proxy it, I only get Invalid Host header

dh1011 commented 5 days ago

Hmm, I'm unable to reproduce the error on my end, which makes it hard to debug. What was the command or the docker-compose.yml you used to run the image?

stauffenberg2020 commented 5 days ago

Hi, Here is the docler compose

services:
 submanager:
  image: dh1011/subscription-manager:multiple-currencies
  container_name: Subscription-Manager
  healthcheck:
      test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/3000' || exit 1
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
  ports:
   - 3541:3000
  environment:
   NODE_ENV: production
   HOST: 0.0.0.0
  volumes:
   - /volume1/docker/submanager/subscriptions.db:/app/subscriptions.db:rw
  restart: on-failure:5

And I always use a blank subscriptions.db from MariusHosting for this testing purposes

dh1011 commented 2 days ago

I was able to reproduce the bug you mentioned. I've implemented a fix in the new release, version 1.2.0. You can check it out at either dh1011/subscription-manager:1.2.0 or dh1011/subscription-manager:latest.

stauffenberg2020 commented 1 day ago

Hi @dh1011,

Thanks for the update. I still find two issues.

  1. Everytime the container is created/updated all the history is gone? Looks like a new database is created every single time
  2. There seems to be a bug in reverse-proxy even with a websocket. It says Invalid Host header
uatevahr commented 22 hours ago

Hi @dh1011,

Thanks for the update. I still find two issues.

  1. Everytime the container is created/updated all the history is gone? Looks like a new database is created every single time
  2. There seems to be a bug in reverse-proxy even with a websocket. It says Invalid Host header

For the reverse proxy, you must add the env, DANGEROUSLY_DISABLE_HOST_CHECK = true.

For me also, the whole database is rewriten. Everything is gone...

Using the latest tag for the image.

Container log shows:

[0] Using subscriptions database located at: /app/server/subscriptions.db due to baseDir: /app/server

[0] Server running on port 5000

[0] Database initialized successfully with new table for user configuration.

dh1011 commented 4 minutes ago

I found the issue with the database. In the latest update, the subscriptions.db file is saved to /app/server instead of the previous /app location. Since your Docker Compose setup binds the volume to /app, this change is likely what caused the issue. I’ve updated the image to ensure that it saves to the original location now. Additionally, you can set the DB_DIR environment variable to specify the location where you'd like to save the database.