List for cgit developers and users
 help / color / mirror / Atom feed
* Syntax highlighting issue
@ 2020-08-26 15:59 Mateja Maric
  2020-08-26 16:11 ` Konstantin Ryabitsev
  0 siblings, 1 reply; 3+ messages in thread
From: Mateja Maric @ 2020-08-26 15:59 UTC (permalink / raw)
  To: cgit

I use cgit on my server (https://git.matejamaric.com) and syntax 
highlighting doesn't work for some reason.

My config file is fine (I think) and python-pygments package is installed.

The weirdest thing is that when I view page source, styling and html 
span tags are there, but code is still not colored for some reason.

This is my cgitrc:

css=/cgit-css/cgit.css
logo=/cgit-css/cgit.png
favicon=/cgit-css/favicon.ico

source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
about-filter=/usr/lib/cgit/filters/about-formatting.sh

root-title=Mateja's repositories
root-desc=Here you can find all my public projects.
snapshots=tar.gz zip
root-readme=/usr/share/webapps/cgit/about.md

clone-url=https://git.matejamaric.com/$CGIT_REPO_URL
enable-index-owner=1
enable-index-links=1
remove-suffix=1
enable-blame=1
enable-commit-graph=1
enable-log-filecount=1
enable-log-linecount=1
branch-sort=age

enable-git-config=1

mimetype.gif=image/gif
mimetype.html=text/html
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml

readme=:README.md
readme=:readme.md
readme=:README.mkd
readme=:readme.mkd
readme=:README.rst
readme=:readme.rst
readme=:README.html
readme=:readme.html
readme=:README.htm
readme=:readme.htm
readme=:README.txt
readme=:readme.txt
readme=:README
readme=:readme
readme=:INSTALL.md
readme=:install.md
readme=:INSTALL.mkd
readme=:install.mkd
readme=:INSTALL.rst
readme=:install.rst
readme=:INSTALL.html
readme=:install.html
readme=:INSTALL.htm
readme=:install.htm
readme=:INSTALL.txt
readme=:install.txt
readme=:INSTALL
readme=:install

project-list=/var/lib/gitolite/projects.list
scan-path=/var/lib/gitolite/repositories


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syntax highlighting issue
  2020-08-26 15:59 Syntax highlighting issue Mateja Maric
@ 2020-08-26 16:11 ` Konstantin Ryabitsev
  2020-08-26 16:24   ` Mateja Maric
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Ryabitsev @ 2020-08-26 16:11 UTC (permalink / raw)
  To: Mateja Maric; +Cc: cgit

On Wed, Aug 26, 2020 at 05:59:06PM +0200, Mateja Maric wrote:
> I use cgit on my server (https://git.matejamaric.com) and syntax
> highlighting doesn't work for some reason.
> 
> My config file is fine (I think) and python-pygments package is installed.
> 
> The weirdest thing is that when I view page source, styling and html span
> tags are there, but code is still not colored for some reason.

If you look at the dev console, you will see the reason:

Refused to apply inline style because it violates the following Content 
Security Policy directive: "default-src 'self'". Either the 
'unsafe-inline' keyword, a hash 
('sha256-icLlI0jX3/L5wqZp69+gNqGNNMcU6bh4T+qqxWv/2as='), or a nonce 
('nonce-...') is required to enable inline execution. Note also that 
'style-src' was not explicitly set, so 'default-src' is used as a 
fallback.

You need to change the Content-Security-Policy header to set style-src 
to allow inline styles. E.g. this is on git.kernel.org:

Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src https:

-K

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syntax highlighting issue
  2020-08-26 16:11 ` Konstantin Ryabitsev
@ 2020-08-26 16:24   ` Mateja Maric
  0 siblings, 0 replies; 3+ messages in thread
From: Mateja Maric @ 2020-08-26 16:24 UTC (permalink / raw)
  To: cgit

It worked! Thank you so much!

On 8/26/20 6:11 PM, Konstantin Ryabitsev wrote:
> On Wed, Aug 26, 2020 at 05:59:06PM +0200, Mateja Maric wrote:
>> I use cgit on my server (https://git.matejamaric.com) and syntax
>> highlighting doesn't work for some reason.
>>
>> My config file is fine (I think) and python-pygments package is installed.
>>
>> The weirdest thing is that when I view page source, styling and html span
>> tags are there, but code is still not colored for some reason.
> If you look at the dev console, you will see the reason:
>
> Refused to apply inline style because it violates the following Content
> Security Policy directive: "default-src 'self'". Either the
> 'unsafe-inline' keyword, a hash
> ('sha256-icLlI0jX3/L5wqZp69+gNqGNNMcU6bh4T+qqxWv/2as='), or a nonce
> ('nonce-...') is required to enable inline execution. Note also that
> 'style-src' was not explicitly set, so 'default-src' is used as a
> fallback.
>
> You need to change the Content-Security-Policy header to set style-src
> to allow inline styles. E.g. this is on git.kernel.org:
>
> Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src https:
>
> -K

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-26 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 15:59 Syntax highlighting issue Mateja Maric
2020-08-26 16:11 ` Konstantin Ryabitsev
2020-08-26 16:24   ` Mateja Maric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).