Add FediFetcher license
This commit is contained in:
parent
89c088d4c5
commit
e3aae6b2a9
|
@ -0,0 +1,9 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Michael Thomas (nanos@thms.uk)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -375,6 +375,7 @@ def requests_headers(token: str=None):
|
|||
|
||||
return headers
|
||||
|
||||
# Adapted from FediFetcher
|
||||
def get_nodeinfo(server, token: str=None, host_meta_fallback = False):
|
||||
headers = requests_headers(token)
|
||||
url = f'https://{server}/.well-known/nodeinfo'
|
||||
|
@ -456,6 +457,7 @@ def get_nodeinfo(server, token: str=None, host_meta_fallback = False):
|
|||
log.error(f'Error getting host node info for {server}. Status Code: {resp.status_code}')
|
||||
return None
|
||||
|
||||
# Adapted from FediFetchre
|
||||
def set_server_apis(server):
|
||||
# support for new server software should be added here
|
||||
software_apis = {
|
||||
|
@ -473,6 +475,7 @@ def set_server_apis(server):
|
|||
if 'mastodon_api' in features:
|
||||
server['mastodonApiSupport'] = True
|
||||
|
||||
# Adapted from FediFetcher
|
||||
def fetch_server_info(server, token: str=None):
|
||||
nodeinfo = get_nodeinfo(server, token=token)
|
||||
if nodeinfo is None:
|
||||
|
|
Loading…
Reference in New Issue