Skip to content

Commit 7b5bc24

Browse files
authored
Merge pull request #18 from linuxserver/v1.2
V1.2
2 parents a5e9954 + 1d390d7 commit 7b5bc24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1091
-155
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ Homestead.json
88
Homestead.yaml
99
npm-debug.log
1010
yarn-error.log
11+
12+
storage/app/public/.DS_Store

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Release Notes
22

3+
## v1.1.2 (2018-02-05)
4+
5+
### Added
6+
- Translation support
7+
- Initial "Supported" application support
8+
9+
### Changed
10+
- button layout and behaviour
11+
12+
### Fixed
13+
- Bottom of button too short in some browsers
14+
- Icon not loading back in when required fields not filled in
15+
16+
317
## v1.1.0 (2018-02-05)
418

519
### Added

app/Http/Controllers/ItemController.php

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,20 @@ public function store(Request $request)
138138
'icon' => $path
139139
]);
140140
}
141+
142+
$config = json_encode($request->input('config'));
143+
if($config) {
144+
$request->merge([
145+
'description' => $config
146+
]);
147+
}
148+
149+
//die(print_r($request->input('config')));
141150

142151
Item::create($request->all());
143152

144153
return redirect()->route('dash')
145-
->with('success','Item created successfully');
154+
->with('success', __('alert.success.item_created'));
146155
}
147156

148157
/**
@@ -197,7 +206,7 @@ public function update(Request $request, $id)
197206
Item::find($id)->update($request->all());
198207

199208
return redirect()->route('dash')
200-
->with('success','Item updated successfully');
209+
->with('success',__('alert.success.item_updated'));
201210
}
202211

203212
/**
@@ -219,7 +228,7 @@ public function destroy(Request $request, $id)
219228
}
220229

221230
return redirect()->route('items.index')
222-
->with('success','Item deleted successfully');
231+
->with('success',__('alert.success.item_deleted'));
223232
}
224233

225234
/**
@@ -235,6 +244,26 @@ public function restore($id)
235244
->where('id', $id)
236245
->restore();
237246
return redirect()->route('items.index')
238-
->with('success','Item restored successfully');
247+
->with('success',__('alert.success.item_restored'));
248+
}
249+
250+
/**
251+
* Return details for supported apps
252+
*
253+
* @return Json
254+
*/
255+
public function appload(Request $request)
256+
{
257+
$app = $request->input('app');
258+
if($app) {
259+
$all_supported = Item::supportedList();
260+
$app_details = new $all_supported[$app];
261+
}
262+
$output['icon'] = $app_details->icon();
263+
$output['colour'] = $app_details->defaultColour();
264+
$output['config'] = $app_details->configDetails();
265+
return json_encode($output);
239266
}
267+
268+
240269
}

app/Http/Controllers/SettingsController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function edit($id)
4040
]);
4141
} else {
4242
return redirect()->route('settings.list')->with([
43-
'error' => 'This Setting does not exist.',
43+
'error' => __('app.alert.error.not_exist'),
4444
]);
4545
}
4646
}
@@ -74,11 +74,11 @@ public function update(Request $request, $id)
7474
$setting->save();
7575

7676
return redirect()->route('settings.index')->with([
77-
'success' => 'You have successfully edited this Setting!',
77+
'success' => __('app.alert.success.setting_updated'),
7878
]);
7979
} else {
8080
return redirect()->route('settings.index')->with([
81-
'error' => 'This Setting does not exist.',
81+
'error' => __('app.alert.error.not_exist'),
8282
]);
8383
}
8484
}
@@ -95,7 +95,7 @@ public function clear($id)
9595
$setting->save();
9696
}
9797
return redirect()->route('settings.index')->with([
98-
'success' => 'You have successfully edited this Setting!',
98+
'success' => __('app.alert.success.setting_updated'),
9999
]);
100100

101101
}

app/Http/Middleware/VerifyCsrfToken.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class VerifyCsrfToken extends Middleware
1313
*/
1414
protected $except = [
1515
//
16-
'order'
16+
'order',
17+
'appload'
1718
];
1819
}

app/Item.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ class Item extends Model
2626
public static function supportedList()
2727
{
2828
return [
29-
'NZBGet' => App\SupportedApps\Nzbget::class,
30-
'Plex' => App\SupportedApps\Plex::class,
29+
'Duplicati' => \App\SupportedApps\Duplicati::class,
30+
'Emby' => \App\SupportedApps\Emby::class,
31+
'NZBGet' => \App\SupportedApps\Nzbget::class,
32+
'pFsense' => \App\SupportedApps\Pfsense::class,
33+
'Pihole' => \App\SupportedApps\Pihole::class,
34+
'Plex' => \App\SupportedApps\Plex::class,
35+
'UniFi' => \App\SupportedApps\Unifi::class,
36+
'Portainer' => \App\SupportedApps\Portainer::class,
3137
];
3238
}
3339
public static function supportedOptions()
@@ -45,4 +51,19 @@ public function scopePinned($query)
4551
{
4652
return $query->where('pinned', 1);
4753
}
54+
55+
public function getConfigAttribute()
56+
{
57+
$output = null;
58+
if(isset($this->description) && !empty($this->description)){
59+
$output = json_decode($this->description);
60+
if(isset($output->type) && !empty($output->type)) {
61+
$class = $output->type;
62+
$sap = new $class();
63+
$view = $sap->configDetails();
64+
}
65+
$output->view = $view;
66+
}
67+
return (object)$output;
68+
}
4869
}

app/Providers/AppServiceProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public function boot()
4646
} else {
4747
Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true));
4848
}
49+
$lang = Setting::fetch('language');
50+
\App::setLocale($lang);
51+
4952
}
5053
view()->share('alt_bg', $alt_bg);
5154

app/Setting.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ class Setting extends Model
1515
*/
1616
protected $table = 'settings';
1717

18+
protected $fillable = [
19+
'id', 'group_id', 'key', 'type', 'options', 'label', 'value', 'order', 'system'
20+
];
21+
1822
/**
1923
* Tell the Model this Table doesn't support timestamps.
2024
*
@@ -45,28 +49,28 @@ public function getListValueAttribute()
4549
switch($this->type) {
4650
case 'image':
4751
if(!empty($this->value)) {
48-
$value = '<a href="'.asset('storage/'.$this->value).'" title="View" target="_blank">View</a>';
52+
$value = '<a href="'.asset('storage/'.$this->value).'" title="'.__('app.settings.view').'" target="_blank">'.__('app.settings.view').'</a>';
4953
} else {
50-
$value = '- not set -';
54+
$value = __('app.options.none');
5155
}
5256
break;
5357
case 'boolean':
5458
if((bool)$this->value === true) {
55-
$value = 'Yes';
59+
$value = __('app.options.yes');
5660
} else {
57-
$value = 'No';
61+
$value = __('app.options.no');
5862
}
5963
break;
6064
case 'select':
6165
if(!empty($this->value) && $this->value !== 'none') {
6266
$options = (array)json_decode($this->options);
63-
$value = $options[$this->value];
67+
$value = __($options[$this->value]);
6468
} else {
65-
$value = '- not set -';
69+
$value = __('app.options.none');
6670
}
6771
break;
6872
default:
69-
$value = $this->value;
73+
$value = __($this->value);
7074
break;
7175
}
7276

@@ -80,11 +84,11 @@ public function getEditValueAttribute()
8084
case 'image':
8185
$value = '';
8286
if(isset($this->value) && !empty($this->value)) {
83-
$value .= '<a class="setting-view-image" href="'.asset('storage/'.$this->value).'" title="View" target="_blank"><img src="'.asset('storage/'.$this->value).'" /></a>';
87+
$value .= '<a class="setting-view-image" href="'.asset('storage/'.$this->value).'" title="'.__('app.settings.view').'" target="_blank"><img src="'.asset('storage/'.$this->value).'" /></a>';
8488
}
8589
$value .= Form::file('value', ['class' => 'form-control']);
8690
if(isset($this->value) && !empty($this->value)) {
87-
$value .= '<a class="settinglink" href="'.route('settings.clear', $this->id).'" title="Remove">Reset back to default</a>';
91+
$value .= '<a class="settinglink" href="'.route('settings.clear', $this->id).'" title="'.__('app.settings.remove').'">'.__('app.settings.reset').'</a>';
8892
}
8993

9094
break;
@@ -102,6 +106,9 @@ public function getEditValueAttribute()
102106
break;
103107
case 'select':
104108
$options = json_decode($this->options);
109+
foreach($options as $key => $opt) {
110+
$options->$key = __($opt);
111+
}
105112
$value = Form::select('value', $options, null, ['class' => 'form-control']);
106113
break;
107114
default:
@@ -199,8 +206,8 @@ public static function search()
199206
$output .= '<div class="searchform">';
200207
$output .= Form::open(['url' => $url, 'method' => 'get']);
201208
$output .= '<div class="input-container">';
202-
$output .= Form::text($var, null, ['class' => 'homesearch', 'placeholder' => $name.' search...']);
203-
$output .= '<button type="submit">Search</button>';
209+
$output .= Form::text($var, null, ['class' => 'homesearch', 'placeholder' => __($name).' '.__('app.settings.search').'...']);
210+
$output .= '<button type="submit">'.ucwords(__('app.settings.search')).'</button>';
204211
$output .= '</div>';
205212
$output .= Form::close();
206213
$output .= '</div>';

app/SupportedApps/Contracts/Applications.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@
33
interface Applications {
44

55
public function defaultColour();
6+
7+
public function icon();
8+
9+
public function configDetails();
610

711
}

app/SupportedApps/Duplicati.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php namespace App\SupportedApps;
2+
3+
class Duplicati implements Contracts\Applications {
4+
public function defaultColour()
5+
{
6+
return '#222';
7+
}
8+
public function icon()
9+
{
10+
return 'supportedapps/duplicati.png';
11+
}
12+
public function configDetails()
13+
{
14+
return null;
15+
}
16+
}

0 commit comments

Comments
 (0)