This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to fix prettyDate display in the drawMessages() func. There was
lots of date arithmetic, none of it documented, which seemd to go round the block and end up where it started. Converting a number to a Date() object, then converting that to a string, then replacing dashes in that string with slashes, converting the result back to another Date() object. It was all very obtuse. On my browser it resulted in all messages being formatted as "just now" which is obviously wrong. I simplified and it seems to work better now.
- Loading branch information
1 parent
f25d647
commit 1616c68
Showing
2 changed files
with
61 additions
and
27 deletions.
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,41 @@ | |||
<?php | |||
// | |||
// CORS allows HTML5 apps running in modern browsers | |||
// to make valid cross-origin requests. | |||
// | |||
// For more on CORS, see | |||
// http://en.wikipedia.org/wiki/Cross-origin_resource_sharing | |||
// | |||
// This PHP module sets the appropriate headers in the webserver | |||
// response, to tell browsers that it's ok to connect to | |||
// api.usergrid.com directly from script. | |||
// | |||
// Another way to add this header is to do so via Webserver | |||
// configuration. You can use one or the other, but you do not need | |||
// both. | |||
// | |||
// NB: This file will work only on webservers that have PHP enabled. | |||
// | |||
|
|||
// Specify domains from which requests are allowed | |||
header('Access-Control-Allow-Origin: https://api.usergrid.com'); | |||
|
|||
// Specify which request methods are allowed | |||
header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); | |||
|
|||
// Additional headers which may be sent along with the CORS request | |||
// The X-Requested-With header allows jQuery requests to go through | |||
header('Access-Control-Allow-Headers: X-Requested-With'); | |||
|
|||
// Set the age to 1 day to improve speed/caching. | |||
header('Access-Control-Max-Age: 86400'); | |||
|
|||
// Exit early so the page isn't fully loaded for options requests | |||
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') { | |||
exit(); | |||
} | |||
|
|||
// delegate to the view | |||
include './index.html'; | |||
|
|||
?> |
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