diff --git a/app/Api/v1/Controllers/IconController.php b/app/Api/v1/Controllers/IconController.php
index 9574ea82..e0a7d8f3 100644
--- a/app/Api/v1/Controllers/IconController.php
+++ b/app/Api/v1/Controllers/IconController.php
@@ -11,6 +11,7 @@ use App\Models\TwoFAccount;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
+use Illuminate\Support\Arr;
class IconController extends Controller
{
@@ -52,7 +53,11 @@ class IconController extends Controller
{
$validated = $request->validated();
- $icon = LogoLib::driver('tfa')->getIcon($validated['service']);
+ $iconCollection = Arr::has($validated, 'iconCollection') && $validated['iconCollection']
+ ? $validated['iconCollection']
+ : $request->user()->preferences['iconCollection'];
+
+ $icon = LogoLib::driver($iconCollection)->getIcon($validated['service']);
return $icon
? response()->json(['filename' => $icon], 201)
diff --git a/app/Api/v1/Requests/IconFetchRequest.php b/app/Api/v1/Requests/IconFetchRequest.php
index b822b824..b6372a1c 100644
--- a/app/Api/v1/Requests/IconFetchRequest.php
+++ b/app/Api/v1/Requests/IconFetchRequest.php
@@ -25,7 +25,8 @@ class IconFetchRequest extends FormRequest
public function rules()
{
return [
- 'service' => 'string',
+ 'service' => 'string',
+ 'iconCollection' => 'nullable|string|in:tfa,selfh,dashboardicons',
];
}
diff --git a/resources/js/services/twofaccountService.js b/resources/js/services/twofaccountService.js
index 60b86a2b..8ffaed2a 100644
--- a/resources/js/services/twofaccountService.js
+++ b/resources/js/services/twofaccountService.js
@@ -23,8 +23,8 @@ export default {
return apiClient.post('/twofaccounts', { uri: uri }, { ...config })
},
- getLogo(service, config = {}) {
- return apiClient.post('/icons/default', { service: service }, { ...config })
+ getLogo(service, iconCollection, config = {}) {
+ return apiClient.post('/icons/default', { service: service, iconCollection: iconCollection }, { ...config })
},
deleteIcon(icon, config = {}) {
diff --git a/resources/js/views/twofaccounts/CreateUpdate.vue b/resources/js/views/twofaccounts/CreateUpdate.vue
index f7326215..0f66b1d2 100644
--- a/resources/js/views/twofaccounts/CreateUpdate.vue
+++ b/resources/js/views/twofaccounts/CreateUpdate.vue
@@ -37,6 +37,11 @@
const iconForm = reactive(new Form({
icon: null
}))
+ const iconCollections = [
+ { text: 'selfh.st', value: 'selfh' },
+ { text: 'dashboardicons.com', value: 'dashboardicons' },
+ { text: '2fa.directory', value: 'tfa' },
+ ]
const otpDisplayProps = ref({
otp_type: '',
account : '',
@@ -69,6 +74,7 @@
const showAdvancedForm = ref(false)
const ShowTwofaccountInModal = ref(false)
const fetchingLogo = ref(false)
+ const iconCollection = ref(user.preferences.iconCollection)
// $refs
const iconInput = ref(null)
@@ -379,7 +385,7 @@
if (user.preferences.getOfficialIcons) {
fetchingLogo.value = true
- twofaccountService.getLogo(form.service, { returnError: true })
+ twofaccountService.getLogo(form.service, iconCollection.value, { returnError: true })
.then(response => {
if (response.status === 201) {
// clean possible already uploaded temp icon
@@ -486,33 +492,52 @@