1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-11-09 11:42:28 +01:00

Merge branch 'cydrobolt:master' into master

This commit is contained in:
Abhishek jain 2022-08-23 03:31:33 +05:30 committed by GitHub
commit 147282e251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1555 additions and 865 deletions

View File

@ -16,7 +16,7 @@ CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=file
VERSION=2.2.0
VERSION_RELMONTH=May
VERSION_RELDAY=6
VERSION_RELYEAR=2017
VERSION=2.3.0
VERSION_RELMONTH=Jan
VERSION_RELDAY=28
VERSION_RELYEAR=2020

View File

@ -3,6 +3,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Redirect;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
use App\Helpers\CryptoHelper;
use App\Models\User;
@ -106,6 +107,8 @@ class SetupController extends Controller {
$polr_recaptcha_site_key = $request->input('setting:recaptcha_site_key');
$polr_recaptcha_secret_key = $request->input('setting:recaptcha_secret_key');
$maxmind_license_key = $request->input('maxmind:license_key');
$acct_username = $request->input('acct:username');
$acct_email = $request->input('acct:email');
$acct_password = $request->input('acct:password');
@ -148,6 +151,7 @@ class SetupController extends Controller {
'APP_STYLESHEET' => $app_stylesheet,
'POLR_GENERATED_AT' => $date_today,
'POLR_SETUP_RAN' => $polr_setup_ran,
'MAXMIND_LICENSE_KEY' => $maxmind_license_key,
'DB_HOST' => $db_host,
'DB_PORT' => $db_port,
@ -215,8 +219,8 @@ class SetupController extends Controller {
}
public static function finishSetup(Request $request) {
// get data from cookie, decode JSON
if (!isset($_COOKIE['setup_arguments'])) {
// Abort if setup arguments are missing.
abort(404);
}
@ -226,12 +230,19 @@ class SetupController extends Controller {
// unset cookie
setcookie('setup_arguments', '', time()-3600);
$transaction_authorised = env('TMP_SETUP_AUTH_KEY') == $setup_finish_args->setup_auth_key;
$transaction_authorised = env('TMP_SETUP_AUTH_KEY') === $setup_finish_args->setup_auth_key;
if ($transaction_authorised != true) {
abort(403, 'Transaction unauthorised.');
}
$usersTableExists = Schema::hasTable('users');
if ($usersTableExists) {
// If the users table exists, then the setup process may have already been completed before.
abort(403, 'Setup has been completed already.');
}
$database_created = self::createDatabase();
if (!$database_created) {
return redirect(route('setup'))->with('error', 'Could not create database. Perhaps your credentials were incorrect?');
@ -240,7 +251,7 @@ class SetupController extends Controller {
if (env('SETTING_ADV_ANALYTICS')) {
$geoip_db_created = self::updateGeoIP();
if (!$geoip_db_created) {
return redirect(route('setup'))->with('error', 'Could not fetch GeoIP database for advanced analytics. Perhaps your server is not connected to the internet?');
return redirect(route('setup'))->with('error', 'Could not fetch GeoIP database for advanced analytics. Perhaps your server is not connected to the internet or your MAXMIND_LICENSE_KEY is incorrect?');
}
}

View File

@ -14,8 +14,9 @@
"torann/geoip": "^1.0",
"geoip2/geoip2": "^2.4",
"nesbot/carbon": "^1.22",
"doctrine/dbal": "^2.5",
"google/recaptcha": "~1.1"
"doctrine/dbal": "2.5.11",
"google/recaptcha": "~1.1",
"symfony/http-foundation": "2.7.51"
},
"require-dev": {
"fzaninotto/faker": "~1.0",

2323
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ return [
'maxmind_database' => [
'class' => \Torann\GeoIP\Services\MaxMindDatabase::class,
'database_path' => storage_path('app/geoip.mmdb'),
'update_url' => 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz',
'update_url' => sprintf('https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=%s&suffix=tar.gz', env('MAXMIND_LICENSE_KEY')),
'locales' => ['en'],
],

View File

@ -0,0 +1,20 @@
# Obtaining a MaxMind GeoIP License Key
-----------------
If you would like to use "advanced analytics" in order to get more insights on your users, you must input a MaxMind GeoIP license key during the setup process or add it later to your configuration file (`.env`).
To obtain a license key, create an account on [MaxMind's website](https://www.maxmind.com/en/geolite2/signup). After you create your account and confirm your email, go to your [MaxMind account page](https://www.maxmind.com/en/accounts/current/license-key) to generate a license key for use with Polr. If you are asked whether your license key will be used for "GeoIP Update", answer no.
Copy your newly generated license key and input it into Polr.
## Troubleshooting
### I'm having trouble running `php artisan geoip:update`, and I'm using an older version of Polr
If you are on an older version of Polr, your installation may be updated. Update Polr by running `git pull` and then add a new entry to your `.env` configuration file:
```
MAXMIND_LICENSE_KEY="LICENSE_KEY_GOES_HERE"
```
Then, run `php artisan config:cache` and `php artisan geoip:update` again.

View File

@ -4,6 +4,7 @@ pages:
- User Guide:
- 'Installation': 'user-guide/installation.md'
- 'Upgrading': 'user-guide/upgrading.md'
- 'Obtaining a MaxMind License Key': 'user-guide/maxmind-license.md'
- 'Troubleshooting': 'user-guide/troubleshooting.md'
- Developer Guide:
- 'Libraries': 'developer-guide/libraries.md'

View File

@ -1,5 +0,0 @@
$('#gpl-license').hide();
$('.license-btn').click(function () {
$('#gpl-license').slideDown();
$('.license-btn').slideUp();
});

View File

@ -18,35 +18,13 @@
<dt>Release date: {{env('POLR_RELDATE')}}</dt>
<dt>App Install: {{env('APP_NAME')}} on {{env('APP_ADDRESS')}} on {{env('POLR_GENERATED_AT')}}<dt>
</dl>
<p>You are seeing the information above because you are logged in as an administrator.</p>
<p>You are seeing the information above because you are logged in as an administrator. You can edit the contents of this page by editing <code>resources/views/about.blade.php</code></p>
@endif
<p>{{env('APP_NAME')}} is powered by Polr 2, an open source, minimalist link shortening platform.
<p>{{env('APP_NAME')}} is powered by Polr 2, an open source, minimalist link shortening platform. The Polr Project is in no way associated with this site.
Learn more at <a href='https://github.com/Cydrobolt/polr'>its Github page</a> or its <a href="//project.polr.me">project site</a>.
<br />Polr is licensed under the GNU GPL License.
</p>
</div>
<a href='#' class='btn btn-success license-btn'>More Information</a>
<pre class="license" id="gpl-license">
Copyright (C) 2013-2017 Chaoyi Zha
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</pre>
@endsection
@section('js')
<script src='/js/about.js'></script>
@endsection

View File

@ -26,6 +26,9 @@ POLR_GENERATED_AT="{{$POLR_GENERATED_AT}}"
# e.g true
POLR_SETUP_RAN={{$POLR_SETUP_RAN}}
# Steps for obtaining a Maxmind License Key: https://docs.polrproject.org/en/latest/user-guide/maxmind-license
MAXMIND_LICENSE_KEY="{{$MAXMIND_LICENSE_KEY}}"
DB_CONNECTION=mysql
# Set to your DB host (e.g localhost)
DB_HOST="{{{$DB_HOST}}}"

View File

@ -65,6 +65,16 @@ Setup
<option value='true'>Enable advanced analytics</option>
</select>
<p>
MaxMind GeoIP License Key (required for advanced analytics only):
</p>
<p>
<input type='text' class='form-control' name='maxmind:license_key' value=''>
<p class='text-muted'>
To obtain a free MaxMind GeoIP license key, follow <a href="https://docs.polrproject.org/en/latest/user-guide/maxmind-license">these instructions</a> on Polr's documentation website.
</p>
<p>Shortening Permissions:</p>
<select name='setting:shorten_permission' class='form-control'>
<option value='false' selected='selected'>Anyone can shorten URLs</option>