-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1acba02
commit a309b8a
Showing
10 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ HTTP/1.1 404 Not Found | |
Content-Type: application/json | ||
|
||
{ | ||
"error": "Not found." | ||
"error": "Not found: /random" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GET /@site HTTP/1.1 | ||
Accept: application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json | ||
|
||
{ | ||
"@id": "http://localhost:8000/@site", | ||
"robots_txt": "Sitemap: {portal_url}/sitemap.xml.gz\n\n# Define access-restrictions for robots/spiders\n# http://www.robotstxt.org/wc/norobots.html\n\n\n\n# By default we allow robots to access all areas of our site\n# already accessible to anonymous users\n\nUser-agent: *\nDisallow:\n\n\n\n# Add Googlebot-specific syntax extension to exclude forms\n# that are repeated for each piece of content in the site\n# the wildcard is only supported by Googlebot\n# http://www.google.com/support/webmasters/bin/answer.py?answer=40367&ctx=sibling\n\nUser-Agent: Googlebot\nDisallow: /*?\nDisallow: /*atct_album_view$\nDisallow: /*folder_factories$\nDisallow: /*folder_summary_view$\nDisallow: /*login_form$\nDisallow: /*mail_password_form$\nDisallow: /@@search\nDisallow: /*search_rss$\nDisallow: /*sendto_form$\nDisallow: /*summary_view$\nDisallow: /*thumbnail_view$\nDisallow: /*view$\n", | ||
"site_logo": null, | ||
"site_title": "Nick" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
nav_order: 24 | ||
permalink: /site | ||
--- | ||
|
||
# Site | ||
|
||
The `@site` endpoint provides general site-wide information, such as the site title, logo, and other information. It uses the view permission, which requires appropriate authorization. | ||
|
||
Send a `GET` request to the `@site` endpoint: | ||
|
||
``` | ||
{% include_relative examples/site/get.req %} | ||
``` | ||
|
||
The response will contain the site information: | ||
|
||
``` | ||
{% include_relative examples/site/get.res %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"id": "site", | ||
"title:i18n": "Site", | ||
"group": "General", | ||
"schema": { | ||
"fieldsets": [ | ||
{ | ||
"fields": ["robots_txt", "site_logo", "site_title"], | ||
"id": "general", | ||
"title": "General" | ||
} | ||
], | ||
"properties": { | ||
"robots_txt": { | ||
"title:i18n": "Robots.txt", | ||
"description:i18n": "This is the contents of the robots.txt file.", | ||
"type": "string", | ||
"widget": "textarea" | ||
}, | ||
"site_logo": { | ||
"description:i18n": "This shows a custom logo on your site.", | ||
"title:i18n": "Site Logo", | ||
"type": "object", | ||
"widget": "file", | ||
"factory": "Image" | ||
}, | ||
"site_title": { | ||
"title:i18n": "Site title", | ||
"description:i18n": "This shows up in the title bar of browsers and in syndication feeds.", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [] | ||
}, | ||
"data": { | ||
"robots_txt": "Sitemap: {portal_url}/sitemap.xml.gz\n\n# Define access-restrictions for robots/spiders\n# http://www.robotstxt.org/wc/norobots.html\n\n\n\n# By default we allow robots to access all areas of our site\n# already accessible to anonymous users\n\nUser-agent: *\nDisallow:\n\n\n\n# Add Googlebot-specific syntax extension to exclude forms\n# that are repeated for each piece of content in the site\n# the wildcard is only supported by Googlebot\n# http://www.google.com/support/webmasters/bin/answer.py?answer=40367&ctx=sibling\n\nUser-Agent: Googlebot\nDisallow: /*?\nDisallow: /*atct_album_view$\nDisallow: /*folder_factories$\nDisallow: /*folder_summary_view$\nDisallow: /*login_form$\nDisallow: /*mail_password_form$\nDisallow: /@@search\nDisallow: /*search_rss$\nDisallow: /*sendto_form$\nDisallow: /*summary_view$\nDisallow: /*thumbnail_view$\nDisallow: /*view$\n", | ||
"site_logo": null, | ||
"site_title": "Nick" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Site route. | ||
* @module routes/site/site | ||
*/ | ||
|
||
import { Controlpanel } from '../../models'; | ||
import { getRootUrl } from '../../helpers'; | ||
|
||
export default [ | ||
{ | ||
op: 'get', | ||
view: '/@site', | ||
permission: 'View', | ||
handler: async (req, trx) => { | ||
const controlpanel = await Controlpanel.fetchById('site'); | ||
const config = controlpanel.data; | ||
|
||
// Return database information | ||
return { | ||
json: { | ||
'@id': `${getRootUrl(req)}/@site`, | ||
robots_txt: config?.robots_txt, | ||
site_logo: config?.site_logo, | ||
site_title: config?.site_title, | ||
}, | ||
}; | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import app from '../../app'; | ||
import { testRequest } from '../../helpers'; | ||
|
||
describe('Site', () => { | ||
it('should get the site information', () => testRequest(app, 'site/get')); | ||
}); |