Skip to content

Commit

Permalink
allow download from private/paid repository
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnux committed Jul 25, 2024
1 parent 1697f18 commit 20f98ab
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 24 deletions.
12 changes: 12 additions & 0 deletions system/controllers/pluginmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
r2(U . "pluginmanager", 's', 'Installation success');
} else if (_post('gh_url', '') != '') {
$ghUrl = _post('gh_url', '');
if(!empty($config['github_token']) && !empty($config['github_username'])) {
$ghUrl = str_replace('https://github.com', 'https://'.$config['github_username'].':'.$config['github_token'].'@github.com', $ghUrl);
}
$plugin = basename($ghUrl);
$file = $cache . $plugin . '.zip';
$fp = fopen($file, 'w+');
Expand Down Expand Up @@ -132,6 +135,9 @@
if ($tipe == 'plugin') {
foreach ($json['plugins'] as $plg) {
if ($plg['id'] == $plugin) {
if(!empty($config['github_token']) && !empty($config['github_username'])) {
$plg['github'] = str_replace('https://github.com', 'https://'.$config['github_username'].':'.$config['github_token'].'@github.com', $plg['github']);
}
$fp = fopen($file, 'w+');
$ch = curl_init($plg['github'] . '/archive/refs/heads/master.zip');
curl_setopt($ch, CURLOPT_POST, 0);
Expand Down Expand Up @@ -180,6 +186,9 @@
if ($tipe == 'plugin') {
foreach ($json['plugins'] as $plg) {
if ($plg['id'] == $plugin) {
if(!empty($config['github_token']) && !empty($config['github_username'])) {
$plg['github'] = str_replace('https://github.com', 'https://'.$config['github_username'].':'.$config['github_token'].'@github.com', $plg['github']);
}
$fp = fopen($file, 'w+');
$ch = curl_init($plg['github'] . '/archive/refs/heads/master.zip');
curl_setopt($ch, CURLOPT_POST, 0);
Expand Down Expand Up @@ -214,6 +223,9 @@
} else if ($tipe == 'payment') {
foreach ($json['payment_gateway'] as $plg) {
if ($plg['id'] == $plugin) {
if(!empty($config['github_token']) && !empty($config['github_username'])) {
$plg['github'] = str_replace('https://github.com', 'https://'.$config['github_username'].':'.$config['github_token'].'@github.com', $plg['github']);
}
$fp = fopen($file, 'w+');
$ch = curl_init($plg['github'] . '/archive/refs/heads/master.zip');
curl_setopt($ch, CURLOPT_POST, 0);
Expand Down
7 changes: 4 additions & 3 deletions system/lan/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,7 @@
"Voucher_invalid": "Voucher invalid",
"Account_Not_Found": "Account Not Found",
"Internet_Voucher_Expired": "Internet Voucher Expired",
"": "",
"Additional_Billing": "Additional Billing",
"_": "-",
"Used_Date": "Used Date",
"Filter": "Filter",
"Start_time": "Start time",
Expand All @@ -672,5 +670,8 @@
"balance": "balance",
"radius": "radius",
"Start_Date": "Start Date",
"End_Date": "End Date"
"End_Date": "End Date",
"New_Version_Notification": "New Version Notification",
"Enabled": "Enabled",
"This_is_to_notify_you_when_new_updates_is_available": "This is to notify you when new updates is available"
}
47 changes: 27 additions & 20 deletions ui/ui/app-settings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,16 @@
<label class="col-md-2 control-label">{Lang::T('New Version Notification')}</label>
<div class="col-md-6">
<select name="new_version_notify" id="new_version_notify" class="form-control">
<option value="enable" {if $_c['new_version_notify']=='enable' }selected="selected" {/if}>{Lang::T('Enabled')}
<option value="enable" {if $_c['new_version_notify']=='enable' }selected="selected"
{/if}>{Lang::T('Enabled')}
</option>
<option value="disable" {if $_c['new_version_notify']=='disable' }selected="selected" {/if}>{Lang::T('Disabled')}
<option value="disable" {if $_c['new_version_notify']=='disable' }selected="selected"
{/if}>{Lang::T('Disabled')}
</option>
</select>
</div>
<p class="help-block col-md-4">{Lang::T('This is to notify you when new updates is available')}</p>
<p class="help-block col-md-4">{Lang::T('This is to notify you when new updates is available')}
</p>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('OTP Required')}</label>
Expand Down Expand Up @@ -722,35 +725,39 @@
<p class="help-block col-md-4">{Lang::T('Enter the custom tax rate (e.g., 3.75 for 3.75%)')}</p>
</div>
</div>

{* <div class="panel-heading" id="envato">
<div class="panel-heading" id="Github_Authentication">
<div class="btn-group pull-right">
<button class="btn btn-primary btn-xs" title="save" type="submit"><span
class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></button>
</div>
Envato / Codecanyon
Github Authentication
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Envato Personal Token</label>
<label class="col-md-2 control-label">Github Username</label>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon">https://github.com/</span>
<input type="text" class="form-control" id="github_username" name="github_username"
value="{$_c['github_username']}" placeholder="ibnux">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Github Token</label>
<div class="col-md-6">
<input type="password" class="form-control" id="envato_token" name="envato_token"
value="{$_c['envato_token']}" placeholder="BldWuBsxxxxxxxxxxxPDzPozHAPui">
<input type="password" class="form-control" id="github_token" name="github_token"
value="{$_c['github_token']}" placeholder="ghp_........">
</div>
<span class="help-block col-md-4"><a href="https://build.envato.com/create-token/"
target="_blank">Create Token</a></span>
<span class="help-block col-md-4"><a href="https://github.com/settings/tokens/new"
target="_blank">Create GitHub personal access token (classic)</a>, only need repo scope</span>
</div>
<div class="form-group">
<label class="control-label col-md-offset-2 col-md-8" style="text-align: left;">Envato
Permission<br>
- View and search Envato sites<br>
- Download the user's purchased items<br>
- List purchases the user has made<br><br>
<a href="https://codecanyon.net/category/php-scripts?term=phpnuxbill" target="_blank"
class="btn btn-xs btn-primary">View MarketPlace</a>
</label>
<label class="control-label col-md-offset-2 col-md-8" style="text-align: left;">This will allow
you to download
plugin from private/paid repository</label>
</div>
</div> *}
</div>
</div>

<div class="panel-body">
Expand Down
2 changes: 2 additions & 0 deletions ui/ui/plugin-manager.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
</div>
</form>

<p class="help-block">To download from private/paid repository, <a href="{$_url}settings/app#Github_Authentication">Set your Github Authentication first</a></p>

<div class="panel panel-primary panel-hovered">
<div class="panel-heading">{Lang::T('Plugin')}
<div class="btn-group pull-right">
Expand Down
2 changes: 1 addition & 1 deletion ui/ui/sections/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
{$_MENU_SETTINGS}
<li {if $_routes[0] eq 'pluginmanager' }class="active" {/if}>
<a href="{$_url}pluginmanager"><i class="glyphicon glyphicon-tasks"></i>
{Lang::T('Plugin Manager')} <small class="label pull-right">Free</small></a>
{Lang::T('Plugin Manager')}</a>
</li>
{/if}
</ul>
Expand Down

0 comments on commit 20f98ab

Please sign in to comment.