chore: update trmnl base url

This commit is contained in:
Benjamin Nussbaum 2026-01-28 12:10:29 +01:00
parent 31ca919ba9
commit 1e43aded77
16 changed files with 109 additions and 73 deletions

View file

@ -49,10 +49,13 @@ class extends Component
try {
$cacheKey = 'trmnl_recipes_newest_page_'.$this->page;
$response = Cache::remember($cacheKey, 43200, function () {
$response = Http::timeout(10)->get('https://usetrmnl.com/recipes.json', [
'sort-by' => 'newest',
'page' => $this->page,
]);
$response = Http::timeout(10)->get(
config('services.trmnl.base_url').'/recipes.json',
[
'sort-by' => 'newest',
'page' => $this->page,
]
);
if (! $response->successful()) {
throw new RuntimeException('Failed to fetch TRMNL recipes');
@ -86,11 +89,14 @@ class extends Component
try {
$cacheKey = 'trmnl_recipes_search_'.md5($term).'_page_'.$this->page;
$response = Cache::remember($cacheKey, 300, function () use ($term) {
$response = Http::get('https://usetrmnl.com/recipes.json', [
'search' => $term,
'sort-by' => 'newest',
'page' => $this->page,
]);
$response = Http::get(
config('services.trmnl.base_url').'/recipes.json',
[
'search' => $term,
'sort-by' => 'newest',
'page' => $this->page,
]
);
if (! $response->successful()) {
throw new RuntimeException('Failed to search TRMNL recipes');
@ -155,7 +161,7 @@ class extends Component
abort_unless(auth()->user() !== null, 403);
try {
$zipUrl = "https://usetrmnl.com/api/plugin_settings/{$recipeId}/archive";
$zipUrl = config('services.trmnl.base_url')."/api/plugin_settings/{$recipeId}/archive";
$recipe = collect($this->recipes)->firstWhere('id', $recipeId);
@ -183,16 +189,21 @@ class extends Component
$this->previewData = [];
try {
$response = Http::timeout(10)->get("https://usetrmnl.com/recipes/{$recipeId}.json");
$response = Http::timeout(10)->get(
config('services.trmnl.base_url')."/recipes/{$recipeId}.json"
);
if ($response->successful()) {
$item = $response->json()['data'] ?? [];
$this->previewData = $this->mapRecipe($item);
} else {
// Fallback to searching for the specific recipe if single endpoint doesn't exist
$response = Http::timeout(10)->get('https://usetrmnl.com/recipes.json', [
'search' => $recipeId,
]);
$response = Http::timeout(10)->get(
config('services.trmnl.base_url').'/recipes.json',
[
'search' => $recipeId,
]
);
if ($response->successful()) {
$data = $response->json()['data'] ?? [];
@ -240,7 +251,9 @@ class extends Component
'installs' => data_get($item, 'stats.installs'),
'forks' => data_get($item, 'stats.forks'),
],
'detail_url' => isset($item['id']) ? ('https://usetrmnl.com/recipes/'.$item['id']) : null,
'detail_url' => isset($item['id'])
? config('services.trmnl.base_url').'/recipes/'.$item['id']
: null,
];
}
}; ?>

View file

@ -29,7 +29,7 @@ new class extends Component {}
<div class="mt-3 flex items-center justify-start gap-2">
<flux:input value="laravel-trmnl" readonly copyable class="max-w-42"/>
<flux:button class="w-42"
href="https://usetrmnl.com/?ref=laravel-trmnl"
href="{{ config('services.trmnl.base_url') }}?ref=laravel-trmnl"
target="_blank"
icon:trailing="arrow-up-right">{{ __('Referral link') }}</flux:button>
</div>

View file

@ -12,7 +12,7 @@
<div class="grid" style="gap: 9px;">
<div class="row row--center col--span-3 col--end">
<img class="weather-image" style="max-height: 150px; margin:auto;"
src="https://usetrmnl.com/images/plugins/weather/wi-thermometer.svg">
src="{{ config('services.trmnl.base_url') }}/images/plugins/weather/wi-thermometer.svg">
</div>
<div class="col col--span-3 col--end">
<div class="item h--full">
@ -28,7 +28,7 @@
<div class="item">
<div class="meta"></div>
<div class="icon">
{{-- <img class="weather-icon" src="https://usetrmnl.com/images/plugins/weather/wi-thermometer.svg"> --}}
{{-- <img class="weather-icon" src="{{ config('services.trmnl.base_url') }}/images/plugins/weather/wi-thermometer.svg"> --}}
</div>
<div class="content">
<span class="value value--small">{{ $weatherEntity['attributes']['wind_speed'] }} {{ $weatherEntity['attributes']['wind_speed_unit'] }}</span>
@ -39,7 +39,7 @@
<div class="item">
<div class="meta"></div>
<div class="icon">
{{-- <img class="weather-icon" src="https://usetrmnl.com/images/weather/wi-raindrops.svg"> --}}
{{-- <img class="weather-icon" src="{{ config('services.trmnl.base_url') }}/images/weather/wi-raindrops.svg"> --}}
</div>
<div class="content">
<span class="value value--small">{{ $weatherEntity['attributes']['humidity'] }}%</span>
@ -50,7 +50,7 @@
<div class="item">
<div class="meta"></div>
<div class="icon">
{{-- <img class="weather-icon" src="https://usetrmnl.com/images/weather/wi-day-sunny.svg"> --}}
{{-- <img class="weather-icon" src="{{ config('services.trmnl.base_url') }}/images/weather/wi-day-sunny.svg"> --}}
</div>
<div class="content">
<span class="value value--xsmall">{{ Str::title($weatherEntity['state']) }}</span>

View file

@ -1,5 +1,5 @@
<script src="https://usetrmnl.com/js/highcharts/12.3.0/highcharts.js"></script>
<script src="https://usetrmnl.com/js/chartkick/5.0.1/chartkick.min.js"></script>
<script src="{{ config('services.trmnl.base_url') }}/js/highcharts/12.3.0/highcharts.js"></script>
<script src="{{ config('services.trmnl.base_url') }}/js/chartkick/5.0.1/chartkick.min.js"></script>
<div class="view view--{{ size }}">
<div class="layout layout--col gap--space-between">

View file

@ -5,7 +5,7 @@
<div class="grid" style="gap: 9px;">
<div class="row row--center col--span-3 col--end">
<img class="weather-image" style="max-height: 150px; margin:auto;"
src="https://usetrmnl.com/images/plugins/weather/wi-thermometer.svg">
src="{{ config('services.trmnl.base_url') }}/images/plugins/weather/wi-thermometer.svg">
</div>
<div class="col col--span-3 col--center">
<div class="item">
@ -21,7 +21,7 @@
<div class="item">
<div class="meta"></div>
<div class="icon">
{{-- <img class="weather-icon" src="https://usetrmnl.com/images/weather/wi-thermometer.svg">--}}
{{-- <img class="weather-icon" src="{{ config('services.trmnl.base_url') }}/images/weather/wi-thermometer.svg">--}}
</div>
<div class="content">
<span
@ -33,7 +33,7 @@
<div class="item">
<div class="meta"></div>
<div class="icon">
{{-- <img class="weather-icon" src="https://usetrmnl.com/images/weather/wi-raindrops.svg">--}}
{{-- <img class="weather-icon" src="{{ config('services.trmnl.base_url') }}/images/weather/wi-raindrops.svg">--}}
</div>
<div class="content">
<span class="value value--small">{{Arr::get($data, 'properties.timeseries.0.data.instant.details.relative_humidity', 'N/A')}}%</span>
@ -44,7 +44,7 @@
<div class="item">
<div class="meta"></div>
<div class="icon">
{{-- <img class="weather-icon" src="https://usetrmnl.com/images/weather/wi-day-sunny.svg">--}}
{{-- <img class="weather-icon" src="{{ config('services.trmnl.base_url') }}/images/weather/wi-day-sunny.svg">--}}
</div>
<div class="content">
<span

View file

@ -18,12 +18,12 @@
href="{{ config('trmnl-blade.framework_css_url') }}">
@else
<link rel="stylesheet"
href="https://usetrmnl.com/css/{{ config('trmnl-blade.framework_version', '1.2.0') }}/plugins.css">
href="{{ config('services.trmnl.base_url') }}/css/{{ config('trmnl-blade.framework_version', '1.2.0') }}/plugins.css">
@endif
@if (config('trmnl-blade.framework_js_url'))
<script src="{{ config('trmnl-blade.framework_js_url') }}"></script>
@else
<script src="https://usetrmnl.com/js/{{ config('trmnl-blade.framework_version', '1.2.0') }}/plugins.js"></script>
<script src="{{ config('services.trmnl.base_url') }}/js/{{ config('trmnl-blade.framework_version', '1.2.0') }}/plugins.js"></script>
@endif
<title>{{ $title ?? config('app.name') }}</title>
</head>