Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style and script urls are not generated correctly because of the appended cache buster #193

Closed
splitt3r opened this issue Jan 2, 2024 · 8 comments
Labels
bug Something isn't working fixed in upcoming release UI API

Comments

@splitt3r
Copy link

splitt3r commented Jan 2, 2024

Thanks for this great app. I'm really looking forward to what people will create with this.

I played around a bit and have some problems. I created a .NET microservice which should be able to create its own top menu entry with a for now very simple page.

The source code is here https:/splitt3r/nextcloud-dotnet-microservice

My problem now is that i can't get the style and script loading to work:

image

image

It tries to load: http://localhost:8080/custom_apps/app_api/css/proxy/dotnet_microservice/style.css
It should in theory also load : http://localhost:8080/custom_apps/app_api/js/proxy/dotnet_microservice/script.js (which it does not yet)

What works is: http://localhost:8080/apps/app_api/proxy/dotnet_microservice/style.css
And also: http://localhost:8080/apps/app_api/proxy/dotnet_microservice/script.js
Content type etc. looks good for those two urls.

Maybe you have a hint what i'm doing wrong here. Thanks in advance

@bigcat88
Copy link
Member

bigcat88 commented Jan 2, 2024

image

http://stable27.local/index.php/apps/app_api/proxy/ui_example/js/ui_example-main.js

It tries to load: http://localhost:8080/custom_apps/app_api/css/proxy/dotnet_microservice/style.css It should in theory also load : http://localhost:8080/custom_apps/app_api/js/proxy/dotnet_microservice/script.js (which it does not yet)

I do not know why there is a css or js in URL before proxy.

What works is: http://localhost:8080/apps/app_api/proxy/dotnet_microservice/style.css
And also: http://localhost:8080/apps/app_api/proxy/dotnet_microservice/script.js

This is what should be, without any css or js before proxy

@andrey18106 andrey18106 added the bug Something isn't working label Jan 2, 2024
@bigcat88
Copy link
Member

bigcat88 commented Jan 2, 2024

https:/cloud-py-api/app_api/blob/f6e7408d85f3066c6e77aaec3094baa9fcdc2d53/lib/Middleware/ExAppUiMiddleware.php#L24-L40

Hmm, looks like we have a bug in code, that should replace js and css...

@bigcat88
Copy link
Member

bigcat88 commented Jan 2, 2024

@splitt3r can you send us a page source or href=.... from page source with these lines(with ExApp urls with js/css..)?

@bigcat88
Copy link
Member

bigcat88 commented Jan 3, 2024

Also please post the records from oc_ex_ui_scripts table.

@splitt3r
Copy link
Author

splitt3r commented Jan 3, 2024

You are right. I found the problem:

...
<link rel="stylesheet" href="/custom_apps/app_api/css/proxy/dotnet_microservice/style.css?v=2bf58b17-0">
...

The cache buster ?v=2bf58b17-0 seems to be the problem:
image
I applied a hacky fix and it works now 👍🏻


I don't know if this can lead to problems too:
image
There should be no index.php here.

@splitt3r splitt3r changed the title Style and script not loading Style and script urls are not generated correctly because of the appended cache buster Jan 3, 2024
@bigcat88
Copy link
Member

bigcat88 commented Jan 3, 2024

Could you apply the changes from the linked PR and say whether there are enough changes in it or not?

@bigcat88
Copy link
Member

bigcat88 commented Jan 3, 2024

I am not sure will it work when apps installed in "custom_apps" dir and "custom_app" will be in url, but probably if needed we can handle that in regex expression too.
But as fat as I know, applications are always mapped in Url to 'apps' folder, no matter how folder is called on the filesystem.

You tell me what works for your setup and what is no, I will correct PR and when all will be working we can merge this PR.

@bigcat88 bigcat88 added the fixed in upcoming release label Jan 3, 2024
bigcat88 added a commit that referenced this issue Jan 3, 2024
Ref: #193


Added support for `?xxx=yyy' at the end of ExApp JS or CSS urls.
@bigcat88
Copy link
Member

bigcat88 commented Jan 8, 2024

fixed in published 1.4.6 version

@bigcat88 bigcat88 closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in upcoming release UI API
Projects
None yet
Development

No branches or pull requests

3 participants