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

Feature requests for the configuration file related to the Email option #1031

Open
MsJamie opened this issue Dec 14, 2022 · 5 comments
Open
Labels
enhancement good first issue Contributors could start with this easy task. help wanted

Comments

@MsJamie
Copy link

MsJamie commented Dec 14, 2022

PrivateBin version: 1.5.0

I'd like to request two features via configuration flags

  1. Option to disable the Email button like can be done with QR Codes
  2. An option to automatically generate a short URL.
  • A. Replacing the paste link (without hitting a button)
  • B. Also replacing the URL in the browser window on successful paste save (if possible)

Not related to this request but is there an alternative way to donate to the project other than cryptocurrency?

@elrido elrido added help wanted good first issue Contributors could start with this easy task. labels Dec 16, 2022
@elrido
Copy link
Contributor

elrido commented Dec 16, 2022

These might be some good first issues for someone that would like to familiarize themselves with the javascript code. I can give some hints if anyone would like to pick this up.

AFAIK the project doesn't take any form of donations right now, other than code contributions ;-) and free tier offerings of webservices (like this github project site here or the project websites), and in particular we don't accept or have ever accepted cryptocurrency. I had looked into applying for the github sponsor system, but it requires to have an organization in certain countries of the world and neither of these would have applied to the project in it's current state.

@rugk
Copy link
Member

rugk commented Dec 30, 2022

Also I'd ask you to create one issue per feature request/separate idea. That said, your second idea is, however, already tracked in #833, which you can upvote if you want to support it, and as such I focus this issue on your first idea.

@rugk rugk changed the title Feature requests for the configuration file related to the Email option and URL shortnener Feature requests for the configuration file related to the Email option Dec 30, 2022
@Alessandro-Battiato
Copy link

Greetings!
I can see you flagged this as a good first issue, but I'm a bit confused as of what's the task, is it now only about adding a functionality to disable the email button using JavaScript?

@elrido
Copy link
Contributor

elrido commented Jan 17, 2023

Yes, I think that this would only be about this one point:

1. Option to disable the Email button like can be done with QR Codes

To provide you some pointers on how this is all tied together, you can track how the qrcode option works - I hope this doesn't kill the fun of the task, treat this as your spoiler warning:

New configuration options, commented or otherwise, in conf.sample.php will only get picked up if a default value is added to the Configuration class:

; (optional) Let users create a QR code for sharing the paste URL with one click.
; It works both when a new paste is created and when you view a paste.
; qrcode = true

'qrcode' => true,

This is then injected into the template file's environment in:

$page->assign('QRCODE', $this->_conf->getKey('qrcode'));

And the templates can use it to remove the modal window (only in the bootstrap template) and button from the HTML (note the email ones right next to it):

<?php
if ($QRCODE) :
?>
<div id="qrcodemodal" tabindex="-1" class="modal fade" aria-labelledby="qrcodemodalTitle" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="mx-auto" id="qrcode-display"></div>
</div>
<div class="row">
<div class="btn-group col-xs-12">
<span class="col-xs-12">
<button type="button" class="btn btn-primary btn-block" data-dismiss="modal"><?php echo I18n::_('Close') ?></button>
</span>
</div>
</div>
</div>
</div>
</div>
<?php
endif;
?>
<div id="emailconfirmmodal" tabindex="-1" class="modal fade" aria-labelledby="emailconfirmmodalTitle" role="dialog" aria-hidden="true">

<button id="emaillink" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> <?php echo I18n::_('Email'), PHP_EOL; ?>
</button>
<?php
if ($QRCODE) :
?>
<button id="qrcodelink" type="button" data-toggle="modal" data-target="#qrcodemodal" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
<span class="glyphicon glyphicon-qrcode" aria-hidden="true"></span> <?php echo I18n::_('QR code'), PHP_EOL; ?>
</button>

PrivateBin/tpl/page.php

Lines 132 to 139 in e84a869

<button id="emaillink" class="hidden"><img src="img/icon_email.png" width="15" height="15" alt="" /><?php echo I18n::_('Email'); ?></button>
<?php
if ($QRCODE):
?>
<button id="qrcodelink" class="hidden"><img src="img/icon_qr.png" width="15" height="15" alt="" /><?php echo I18n::_('QR code'); ?></button>
<?php
endif;
?>

@Alessandro-Battiato
Copy link

Thanks for taking your time to explain my question, but I apologize in advance as I think I don't have the necessary knowledge to work on your project as I was convinced for some reason that only JavaScript was used, I have no knowledge of PHP whatsoever, but thanks anyway for the explanation I'm sure it'll come in handy for someone else who can work with this :)

sergiorgiraldo added a commit to sergiorgiraldo/PrivateBin that referenced this issue Sep 9, 2023
::by sergio giraldo
@ 20230909T2226CEST, gpg signed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Contributors could start with this easy task. help wanted
Projects
Status: Backlog
Development

No branches or pull requests

4 participants