SilentVoid13 / Templater

A template plugin for obsidian
https://silentvoid13.github.io/Templater
GNU Affero General Public License v3.0
3.13k stars 187 forks source link

Random picture generator inoperable #1435

Open FrumpyMonk opened 3 weeks ago

FrumpyMonk commented 3 weeks ago

Hello,

As the subject line indicates, it looks like the web call for random picture generator is no longer working. Here are the details.

Describe the bug

The templater code <% tp.web.random_picture() %> produces the response "Error generating random picture".

Expected behavior As of last week Wendesday, the same code produced a random picture from unsplashed.

Additional context The direct link that accompanies this function, https://templater-unsplash.fly.dev, is no longer producing an image, either.

Is there any indication whether unsplahed has changed its APIs and/or if this feature will return?

Thank you

snowfield516 commented 3 weeks ago

image same problem

marvincyk commented 3 weeks ago

I'm facing the same problem. I generate the random image at the start of my Daily Notes template and this issue with the API is causing the rest of my template to delay loading.

linglilongyi commented 3 weeks ago

Is it something with the 'archived api'?

stephen-ondyr commented 3 weeks ago

Also having same issue

Zachatoo commented 3 weeks ago

Looks like for whatever reason, the proxy for unsplash that shabegom added went down. I do not expect they will be available to bring it back up. I will investigate hosting my own proxy or finding another way to bring this functionality back.

FrumpyMonk commented 3 weeks ago

@Zachatoo

Your help would be terrific. Generating the random image is a small thing, but it does make a big difference in a wide array of workflows. Thanks!

linglilongyi commented 3 weeks ago

Looks like for whatever reason, the proxy for unsplash that shabegom added went down. I do not expect they will be available to bring it back up. I will investigate hosting my own proxy or finding another way to bring this functionality back.

I test it yesterday, but it seems that the new proxy [[https://templater-unsplash-2.fly.dev]] went down again. Would somebody have a try on it?

the error message from dev tools:

Access to fetch at 'https://templater-unsplash-2.fly.dev/' from origin 'app://obsidian.md' has been blocked by CORS policy: No > 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the > > request's mode to 'no-cors' to fetch the resource with CORS disabled.

Zachatoo commented 3 weeks ago

The new proxy isn't ready yet. I was hoping to just reuse the same code, but the app keeps crashing. I certainly appreciate your enthusiasm to test it though!

I'll comment here once I'm confident the new proxy is ready.

Zachatoo commented 3 weeks ago

The new proxy should be up and running! Please let me know if it isn't working for you. Please keep in mind that we are rate limited. I'll keep an eye on the metrics to see how we're doing on staying below the rate limit.

snowfield516 commented 3 weeks ago

So does the daily_quote: <% tp.web.daily_quote() %> image

Zachatoo commented 3 weeks ago

We're tracking daily quotes not working here #1407 , it's an unrelated issue.

get6 commented 3 weeks ago

I updated Templater to version 2.4.2

The result of this command(<% tp.web.random_picture() %>) is shown below

스크린샷 2024-08-24 오전 11 24 43

When I pass in a parameter(<% tp.web.random_picture("768x432") %>) I got an error statement. Error generating random picture.

What should I do?!

Anyway Thanks you for solving the issue so quickly!

Zachatoo commented 1 week ago

We're hitting about 400 requests an hour, which is well above the limit. I'll need to look into increasing the limit, having each user create their own API key instead of sharing a single API key, or switching services.

Zachatoo commented 1 week ago

Each user having their own API key is against the TOS, so I will not be doing that.

I have applied for increased limits, I should hear back in 5-10 business days.