Skip to content
Open
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
3 changes: 2 additions & 1 deletion extras/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from core.events import *
from extras.choices import LogLevelChoices

Expand Down Expand Up @@ -85,7 +86,7 @@
'height': 4,
'title': 'NetBox News',
'config': {
'feed_url': 'https://api.netbox.oss.netboxlabs.com/v1/newsfeed/',
'feed_url': settings.NEWSFEED_URL,
'max_entries': 10,
'cache_timeout': 14400,
'requires_internet': True,
Expand Down
8 changes: 7 additions & 1 deletion netbox/config/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,14 @@ def __init__(self, name, label, default, description='', field=None, field_kwarg
ConfigParam(
name='MAPS_URL',
label=_('Maps URL'),
default='https://maps.google.com/?q=',
default='https://www.google.com/maps/search/?api=1&query=',
description=_("Base URL for mapping geographic locations")
),
ConfigParam(
name='NEWSFEED_API_VERSION',
label=_('Newsfeed API Version'),
default='v1',
description=_("Version of the Newsfeed API to use (v1 or v2)")
),

)
19 changes: 19 additions & 0 deletions netbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,25 @@ def _setting(name, default=None):

PLUGIN_CATALOG_URL = 'https://api.netbox.oss.netboxlabs.com/v1/plugins'

#
# Newsfeed API Configuration
#

# Configurable Newsfeed API version (default: "v1")
NEWSFEED_API_VERSION = getattr(configuration, 'NEWSFEED_API_VERSION', 'v1')

# Base URL for newsfeed API
NEWSFEED_BASE_URL = 'https://api.netbox.oss.netboxlabs.com/newsfeed/'

# Construct the final newsfeed URL based on version
if NEWSFEED_API_VERSION == 'v1':
NEWSFEED_URL = 'https://api.netbox.oss.netboxlabs.com/v1/newsfeed/'
elif NEWSFEED_API_VERSION == 'v2':
NEWSFEED_URL = f'{NEWSFEED_BASE_URL}?version=2'
else:
# Fallback to base URL for any other version
NEWSFEED_URL = NEWSFEED_BASE_URL

EVENTS_PIPELINE = list(EVENTS_PIPELINE)
if 'extras.events.process_event_queue' not in EVENTS_PIPELINE:
EVENTS_PIPELINE.insert(0, 'extras.events.process_event_queue')
Expand Down