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

fix installer #843

Merged
merged 3 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Console/Commands/InstallDev.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public function handle()

$this->line('Kunci akses penginstal web');

if (!is_file($file = storage_path('installed'))) {
if (!sudahInstal()) {
file_put_contents(
$file,
storage_path('installed'),
sprintf('%s berhasil DIPASANG pada %s', config('app.name'), now())
);
}
Expand Down
144 changes: 75 additions & 69 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,82 +64,88 @@ class Controller extends BaseController
/**
* Menampilkan Sebutan Wilayah Tingkat III (Kecamatan/Distrik)
*/

protected $akun_camat;
protected $akun_sekretaris;
protected $browser_title;
protected $nama_camat;
protected $profil;
protected $sebutan_wilayah;
protected $sebutan_kepala_wilayah;
protected $browser_title;
protected $sebutan_tambahan;
protected $sebutan_wilayah;
protected $settings;
protected $umum;

public function __construct()
{
$this->profil = Profil::first();
$this->umum = DataUmum::first();
$this->nama_camat = Pengurus::status()->camat()->first();

// Pemeriksaan akun pengurus untuk alur pemeriksaan surat
$this->akun_camat = Pengurus::status()->akunCamat()->first();
$this->akun_sekretaris = Pengurus::status()->akunSekretaris()->first();

if (! $this->akun_camat) {
SettingAplikasi::where('key', 'tte')->update(['value' => 0]);
SettingAplikasi::where('key', 'pemeriksaan_camat')->update(['value' => 0]);
}

if (! $this->akun_sekretaris) {
SettingAplikasi::where('key', 'pemeriksaan_sekretaris')->update(['value' => 0]);
}

// Tambahan global variabel di luar setting aplikasi
$this->sebutan_tambahan = [
'sebutan_camat' => Jabatan::where('jenis', JenisJabatan::Camat)->first()->nama,
'sebutan_sekretaris' => Jabatan::where('jenis', JenisJabatan::Sekretaris)->first()->nama,
];

// Global variabel setting aplikasi
$this->settings = SettingAplikasi::pluck('value', 'key');
$this->settings = $this->settings->merge($this->sebutan_tambahan);
View::share('settings', $this->settings);

if (in_array($this->profil->provinsi_id, [91, 92])) {
$this->sebutan_wilayah = 'Distrik';
$this->sebutan_kepala_wilayah = 'Kepala Distrik';
} else {
$this->sebutan_wilayah = 'Kecamatan';
$this->sebutan_kepala_wilayah = 'Camat';
}

if ($this->settings['tte']) {
SettingAplikasi::where('key', 'pemeriksaan_camat')->update(['value' => 1]);
if (sudahInstal()) {
$this->profil = Profil::first();
$this->umum = DataUmum::first();
$this->nama_camat = Pengurus::status()->camat()->first();

// Pemeriksaan akun pengurus untuk alur pemeriksaan surat
$this->akun_camat = Pengurus::status()->akunCamat()->first();
$this->akun_sekretaris = Pengurus::status()->akunSekretaris()->first();

if (! $this->akun_camat) {
SettingAplikasi::where('key', 'tte')->update(['value' => 0]);
SettingAplikasi::where('key', 'pemeriksaan_camat')->update(['value' => 0]);
}

if (! $this->akun_sekretaris) {
SettingAplikasi::where('key', 'pemeriksaan_sekretaris')->update(['value' => 0]);
}

// Tambahan global variabel di luar setting aplikasi
$this->sebutan_tambahan = [
'sebutan_camat' => Jabatan::where('jenis', JenisJabatan::Camat)->first()->nama,
'sebutan_sekretaris' => Jabatan::where('jenis', JenisJabatan::Sekretaris)->first()->nama,
];

// Global variabel setting aplikasi
$this->settings = SettingAplikasi::pluck('value', 'key');
$this->settings = $this->settings->merge($this->sebutan_tambahan);
View::share('settings', $this->settings);

if (in_array($this->profil->provinsi_id, [91, 92])) {
$this->sebutan_wilayah = 'Distrik';
$this->sebutan_kepala_wilayah = 'Kepala Distrik';
} else {
$this->sebutan_wilayah = 'Kecamatan';
$this->sebutan_kepala_wilayah = 'Camat';
}

if ($this->settings['tte']) {
SettingAplikasi::where('key', 'pemeriksaan_camat')->update(['value' => 1]);
}

$this->kirimTrack();

// TODO : Gunakan untuk semua pengaturan jika sudah tersedia
$this->browser_title = SettingAplikasi::where('key', 'judul_aplikasi')->first()->value ?? ucwords($this->sebutan_wilayah . ' ' . $this->profil->nama_kecamatan);

$events = Event::getOpenEvents();
$sinergi = SinergiProgram::where('status', 1)->orderBy('urutan', 'asc')->get();
$medsos = MediaSosial::where('status', 1)->get();
$navdesa = DataDesa::all();
$navpotensi = TipePotensi::orderby('nama_kategori', 'ASC')->get();
$pengurus = Pengurus::status()->get();
$slides = Slide::orderBy('created_at', 'DESC')->get();

View::share([
'profil' => $this->profil,
'sebutan_wilayah' => $this->sebutan_wilayah,
'sebutan_kepala_wilayah' => $this->sebutan_kepala_wilayah,
'browser_title' => $this->browser_title,
'events' => $events,
'sinergi' => $sinergi,
'medsos' => $medsos,
'navdesa' => $navdesa,
'navpotensi' => $navpotensi,
'camat' => $this->nama_camat,
'pengurus' => $pengurus->sortBy('jabatan.jenis'),
'slides' => $slides,
]);
}

$this->kirimTrack();

// TODO : Gunakan untuk semua pengaturan jika sudah tersedia
$this->browser_title = SettingAplikasi::where('key', 'judul_aplikasi')->first()->value ?? ucwords($this->sebutan_wilayah . ' ' . $this->profil->nama_kecamatan);

$events = Event::getOpenEvents();
$sinergi = SinergiProgram::where('status', 1)->orderBy('urutan', 'asc')->get();
$medsos = MediaSosial::where('status', 1)->get();
$navdesa = DataDesa::all();
$navpotensi = TipePotensi::orderby('nama_kategori', 'ASC')->get();
$pengurus = Pengurus::status()->get();
$slides = Slide::orderBy('created_at', 'DESC')->get();

View::share([
'profil' => $this->profil,
'sebutan_wilayah' => $this->sebutan_wilayah,
'sebutan_kepala_wilayah' => $this->sebutan_kepala_wilayah,
'browser_title' => $this->browser_title,
'events' => $events,
'sinergi' => $sinergi,
'medsos' => $medsos,
'navdesa' => $navdesa,
'navpotensi' => $navpotensi,
'camat' => $this->nama_camat,
'pengurus' => $pengurus->sortBy('jabatan.jenis'),
'slides' => $slides,
]);
}

protected function kirimTrack()
Expand Down
5 changes: 1 addition & 4 deletions app/Http/Middleware/KDInstalled.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@

use Closure;

use function file_exists;

use Illuminate\Http\Request;

use function redirect;
use function storage_path;

class KDInstalled
{
Expand All @@ -50,7 +47,7 @@ class KDInstalled
*/
public function handle($request, Closure $next)
{
if (! file_exists(storage_path('installed'))) {
if (! sudahInstal()) {
return redirect()->to('install');
}
return $next($request);
Expand Down
11 changes: 7 additions & 4 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ public function boot()
{
// default lengt string
Schema::defaultStringLength(191);
$this->penduduk();
$this->config();
$this->blade();
$this->file();

if (sudahInstal()) {
$this->penduduk();
$this->config();
$this->blade();
$this->file();
}
}

protected function penduduk()
Expand Down
1 change: 1 addition & 0 deletions catatan_rilis.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Terima kasih pada [untuk diisi] yang terus berkontribusi.
3. [#838](https://github.com/OpenSID/OpenDK/issues/838) Penyesuaian package yang tidak digunakan.
4. [#828](https://github.com/OpenSID/OpenDK/issues/828) Penyesuaian editor menggunakan tinymce pada form event.
4. [#854](https://github.com/OpenSID/OpenDK/issues/854) Penyesuaian editor menggunakan tinymce pada form data umum.
6. [#842](https://github.com/OpenSID/OpenDK/issues/842) Penyesuaian proses instalasi dengan wizard.

#### Peningkatan Keamanan

Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
|
*/

'key' => env('APP_KEY'),
'key' => env('APP_KEY', 'base64:rN3vXWFRHDKFP2sMySe9f4gna7WulisoXTqn7Yo4Ye8='),

'cipher' => 'AES-256-CBC',

Expand Down
15 changes: 15 additions & 0 deletions helpers/general_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,18 @@ function terbilang($angka)

return $terbilang;
}

if (!function_exists('sudahInstal')) {
/**
* Cek apakah sudah install OpenDK atau belum
*
* @return bool True jika sudah install, False jika belum install
*/
function sudahInstal(): bool
{
if (! file_exists(storage_path('installed'))) {
return false;
}
return true;
}
}