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

Preview of theming does not work anymore #5975

Closed
MorrisJobke opened this issue Aug 4, 2017 · 5 comments
Closed

Preview of theming does not work anymore #5975

MorrisJobke opened this issue Aug 4, 2017 · 5 comments

Comments

@MorrisJobke
Copy link
Member

  • change a value in the theming app
  • wait for it to be saved
  • then the "Loading preview" will show up
  • actual: it loads endlessly and if you look at the network it will show you a 404 on css/core/server.css
  • expected: the server.css is properly loaded and the loading spinner goes away

Problem: The server.css is in my instance for example served under css/core/72408cbdff8901cd16b886aeabcc367c-server.css - I guess the reloadStylesheets() method needs an adjustment to fetch the current name of this an reload that css.

var reloadStylesheets = function(cssFile) {
var queryString = '?reload=' + new Date().getTime();
var url = OC.generateUrl(cssFile) + queryString;
var old = $('link[href*="' + cssFile.replace("/","\/") + '"]');
var stylesheet = $("<link/>", {
rel: "stylesheet",
type: "text/css",
href: url
});
stylesheet.load(function () {
$(old).remove();
stylesheetsLoaded--;
if(stylesheetsLoaded === 0) {
$('#theming_settings_loading').hide();
var response = { status: 'success', data: {message: t('theming', 'Saved')}};
OC.msg.finishedSaving('#theming_settings_msg', response);
}
});
stylesheet.appendTo("head");
};
reloadStylesheets('/css/core/server.css');

cc @danxuliu @juliushaertl @nextcloud/theming

Valid for at least master.

@MorrisJobke MorrisJobke added this to the Nextcloud 13 milestone Aug 4, 2017
@danxuliu danxuliu self-assigned this Aug 4, 2017
@danxuliu
Copy link
Member

danxuliu commented Aug 4, 2017

I was already working on fixing this ;-)

@juliusknorr
Copy link
Member

juliusknorr commented Aug 4, 2017

Also broken on 12.0.1 RC4 🙈

danxuliu added a commit that referenced this issue Aug 4, 2017
Pull request #5429 made cached SCSS files depend on a hash of the base
URL, so the "/css/core/server.css" file does no longer exist; as the
file can not be loaded the "Loading preview" message is never removed
and the "Saved" message is never shown.

As it now depends on the hash of the base URL the file to be reloaded
can no longer be hardcoded, so the DataResponse from the controller now
provides the full URL to the "server.css" file that has to be reloaded
(if any).

Fixes #5975

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
danxuliu added a commit that referenced this issue Aug 4, 2017
Pull request #5429 made cached SCSS files depend on a hash of the base
URL, so the "/css/core/server.css" file does no longer exist; as the
file can not be loaded the "Loading preview" message is never removed
and the "Saved" message is never shown.

As it now depends on the hash of the base URL the file to be reloaded
can no longer be hardcoded, so the DataResponse from the controller now
provides the full URL to the "server.css" file that has to be reloaded
(if any).

Fixes #5975

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
danxuliu added a commit that referenced this issue Aug 8, 2017
Pull request #5429 made cached SCSS files depend on a hash of the base
URL, so the "/css/core/server.css" file does no longer exist; as the
file can not be loaded the "Loading preview" message is never removed
and the "Saved" message is never shown.

As it now depends on the hash of the base URL the file to be reloaded
can no longer be hardcoded, so the DataResponse from the controller now
provides the full URL to the "server.css" file that has to be reloaded
(if any).

Fixes #5975

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@MorrisJobke
Copy link
Member Author

Fix is in #5981

danxuliu added a commit that referenced this issue Aug 10, 2017
Pull request #5429 made cached SCSS files depend on a hash of the base
URL, so the "/css/core/server.css" file does no longer exist; as the
file can not be loaded the "Loading preview" message is never removed
and the "Saved" message is never shown.

As it now depends on the hash of the base URL the file to be reloaded
can no longer be hardcoded, so the full URL to the "server.css" file
that has to be reloaded (if any) is now got from the DataResponse
provided by the controller.

Fixes #5975

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
danxuliu added a commit that referenced this issue Aug 10, 2017
Pull request #5584 made cached SCSS files depend on a hash of the base
URL, so the "/css/core/server.css" file does no longer exist; as the
file can not be loaded the "Loading preview" message is never removed
and the "Saved" message is never shown.

As it now depends on the hash of the base URL the file to be reloaded
can no longer be hardcoded, so the full URL to the "server.css" file
that has to be reloaded (if any) is now got from the DataResponse
provided by the controller.

Fixes #5975

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@fduraibi
Copy link

I think I have the same issue and it is cause by caching.

When I disable caching it works fine.
Is there a way to force reloading the new files into the cache whenever there is a theme change?

@nursoda
Copy link

nursoda commented Oct 8, 2019

Seems I'm hit by this in NC17, too. Standard setup of nginx/mariadb/apcu/redis on Arch.

I get 404 for https://test.seyfarth.de/apps/theming/styles?reload=1570557643276.
FX_DevConsoleNetwork says "cache-control: no-cache, no-store, must-revalidate".

@fduraibi What do you mean by disabling cache? Redis? Not an option except for debugging :-)

Edit: Just noticed that it works fine in Chrome, and that I have plenty of CSP blocked URIs in Firefox. If anyone has a hint on where to debug THAT (but that's off-topic, sorry).

During my tests I also encountered that the page is missing css altogehter, I then see these error messages:

Refused to apply style from 'https://cloud.domain.com/css/core/68b4-bd84-results.css?v=1f648e556779fb4921ea9f25d235efb0-93b5eae9-31' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants