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

Avoid window.open and add more visible eye icon #1996

Merged
merged 14 commits into from
Dec 21, 2021

Conversation

paul-man
Copy link
Contributor

@paul-man paul-man commented Dec 2, 2021

By submitting this pull request, I confirm the following: {please fill any appropriate checkboxes, e.g: [X]}

{Please ensure that your pull request is for the 'devel' branch!}

  • I have read and understood the contributors guide, as well as this entire template.
  • I have made only one major change in my proposed changes.
  • I have commented my proposed changes within the code.
  • I have tested my proposed changes.
  • I am willing to help maintain this change if there are issues with it later.
  • I give this submission freely and claim no ownership.
  • It is compatible with the EUPL 1.2 license
  • I have squashed any insignificant commits. (git rebase)
  • I have Signed Off all commits. (git commit --signoff)

What does this PR aim to accomplish?:

Resolve #1353

How does this PR accomplish the above?:

Replace usage of window.open(url) and window.open(url, '_self') with window.location.href = url
Issue #1353 also had discussion of replacing the current logic for hiding pie chart slices so that it could work better on mobile. Updating usage of window.open() seems so small that I'm not sure if it warranted 2 separate PRs so I've included both changes.

What documentation changes (if any) are needed to support this PR?:

Maybe update the pie chart screenshot in the read.me to this:
image

Signed-off-by: Paul Mannarino <[email protected]>
Signed-off-by: Paul Mannarino <[email protected]>
Signed-off-by: Paul Mannarino <[email protected]>
Signed-off-by: Paul Mannarino <[email protected]>
Signed-off-by: Paul Mannarino <[email protected]>
@yubiuser
Copy link
Member

yubiuser commented Dec 2, 2021

Please file against devel branch

Signed-off-by: Paul Mannarino <[email protected]>
@paul-man paul-man closed this Dec 2, 2021
@paul-man paul-man reopened this Dec 2, 2021
@paul-man paul-man changed the base branch from master to devel December 2, 2021 23:29
Signed-off-by: Paul Mannarino <[email protected]>
<h4 class="modal-title" id="apiTokenModalHeaderLabel">API Token</h4>
</div>
<div class="modal-body">
<pre><iframe id="apiTokenIframe" name="apiToken_iframe" src="scripts/pi-hole/php/api_token.php"></iframe></pre>
Copy link
Contributor Author

@paul-man paul-man Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The QR code doesn't look great on mobile. Because it's built using a <table> the height can only be responsive to a certain extent. I tried using the createImage() function from the QR code lib being used but no dice.

Not sure how important this is, since if you're accessing the API token on mobile you most likely will be copying the raw string rather than using another mobile device to take a photo of the qr code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion it's an edge case. Generating a qr code with a mobile to be scanned with another mobile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. This is how it looks on my screen:
Screenshot_20211209-205750.png

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Could you add support for the theme's font color as we did in #1934. (Otherwise it's black font on black background in the dark themes)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be safer to always use white background and black text for the <pre> element that displays the QRcode (even in dark themes).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use a white background no matter the theme. My QR scanner worked with each theme. Thanks for pointing this out and brainstorming on this!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nit: could could you remove (or color white) the small leftover margin. Best seen in LCARS theme

Bildschirmfoto zu 2021-12-14 07-11-32

Copy link
Member

@rdwebdesign rdwebdesign Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the <pre> background-color.

You just need to add this into pi-hole.css:

#apiTokenModal pre {
    background: #FFF;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also in the other themes!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited.

@yubiuser
Copy link
Member

pi-hole/pi-hole#4461 adjusts the lighttpd.conf in the core repo to allow the iframe

Signed-off-by: Paul Mannarino <[email protected]>
@paul-man paul-man force-pushed the feat/avoid-window-open branch from a30fcab to 1c12e97 Compare December 14, 2021 00:08
Signed-off-by: Paul Mannarino <[email protected]>
@yubiuser
Copy link
Member

Sorry for the inconvenience. The PHPStan erros should be fixed now. Please rebase on latest devel

@MichaIng MichaIng mentioned this pull request Dec 19, 2021
7 tasks
@DL6ER DL6ER changed the title Feat/avoid window open Avoid window.open and add more visible eye icon Dec 21, 2021
@DL6ER DL6ER merged commit 2b594d6 into pi-hole:devel Dec 21, 2021
@DL6ER DL6ER mentioned this pull request Dec 22, 2021
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-ftl-v5-12-web-v5-9-and-core-v5-7-released/51795/1

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

Successfully merging this pull request may close these issues.

Stop using window.open when possible
5 participants