mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 10:04:52 +00:00
feat: imgur proxying for blocked countries (#7104)
This commit is contained in:
@@ -300,7 +300,7 @@ const {
|
||||
setModpackAlreadyInstalledModal,
|
||||
handleModpackDuplicateCreateAnyway,
|
||||
handleModpackDuplicateGoToInstance,
|
||||
} = setupProviders(notificationManager, popupNotificationManager)
|
||||
} = setupProviders(tauriApiClient, notificationManager, popupNotificationManager)
|
||||
|
||||
const news = ref([])
|
||||
const displayedServerInviteNotifications = new Set()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { AbstractModrinthClient } from '@modrinth/api-client'
|
||||
import type { AbstractPopupNotificationManager, AbstractWebNotificationManager } from '@modrinth/ui'
|
||||
|
||||
import { setupCreationModal } from './setup/creation-modal'
|
||||
@@ -5,11 +6,14 @@ import { setupFileDropProvider } from './setup/file-drop'
|
||||
import { setupFilePickerProvider } from './setup/file-picker'
|
||||
import { setupInstanceImportProvider } from './setup/instance-import'
|
||||
import { setupTagsProvider } from './setup/tags'
|
||||
import { setupUserCountryProvider } from './setup/user-country'
|
||||
|
||||
export function setupProviders(
|
||||
client: AbstractModrinthClient,
|
||||
notificationManager: AbstractWebNotificationManager,
|
||||
_popupNotificationManager: AbstractPopupNotificationManager,
|
||||
) {
|
||||
setupUserCountryProvider(client)
|
||||
setupTagsProvider(notificationManager)
|
||||
setupFileDropProvider()
|
||||
setupFilePickerProvider()
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { AbstractModrinthClient } from '@modrinth/api-client'
|
||||
import { provideUserCountry } from '@modrinth/ui'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export function setupUserCountryProvider(client: AbstractModrinthClient) {
|
||||
const country = ref('US')
|
||||
|
||||
void client.labrinth.geoip
|
||||
.getCountry()
|
||||
.then((detectedCountry) => {
|
||||
country.value = detectedCountry ?? country.value
|
||||
})
|
||||
.catch(() => {})
|
||||
|
||||
return provideUserCountry(country)
|
||||
}
|
||||
Reference in New Issue
Block a user