Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More informative DNS-SD service name
  • Loading branch information
da2x committed Oct 10, 2015
1 parent 4572f4c commit bd932db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nikola/utils.py
Expand Up @@ -40,6 +40,7 @@
import re
import json
import shutil
import socket
import subprocess
import sys
import dateutil.parser
Expand Down Expand Up @@ -1819,6 +1820,7 @@ def dns_sd(port, inet6):
import avahi
import dbus
inet = avahi.PROTO_INET6 if inet6 else avahi.PROTO_INET
name = "{0}'s Nikola Server on {1}".format(os.getlogin(), socket.gethostname())
bus = dbus.SystemBus()
bus_server = dbus.Interface(bus.get_object(avahi.DBUS_NAME,
avahi.DBUS_PATH_SERVER),
Expand All @@ -1827,7 +1829,7 @@ def dns_sd(port, inet6):
bus_server.EntryGroupNew()),
avahi.DBUS_INTERFACE_ENTRY_GROUP)
bus_group.AddService(avahi.IF_UNSPEC, inet, dbus.UInt32(0),
'Nikola Server', '_http._tcp', '', '',
name, '_http._tcp', '', '',
dbus.UInt16(port), '')
bus_group.Commit()
return bus_group # remember to bus_group.Reset() to unpublish
Expand Down

4 comments on commit bd932db

@Kwpolska
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? Who would use this and how?

@da2x
Copy link
Contributor Author

@da2x da2x commented on bd932db Oct 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • In Safari on the Mac: Bookmarks menu: Nearby
  • In Epiphany (GNOME Web): Bookmarks menu: Nearby
  • avahi-bookmarks && xdg-open http://localhost:8080

@da2x
Copy link
Contributor Author

@da2x da2x commented on bd932db Oct 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it so I don’t have to remember my computers IP addresses. I preview pages in different browsers and OSes from time to time.

@Kwpolska
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually have a tiny DNS server on my home network. http://cassandra.kw:8000/ is a thing.

Please sign in to comment.