diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..95bec84 --- /dev/null +++ b/.htaccess @@ -0,0 +1,4 @@ +AuthType Basic +AuthName "Restricted Area" +AuthUserFile /var/www/Podcast-RSS-Editor/.htpasswd +Require valid-user diff --git a/.htpasswd b/.htpasswd new file mode 100644 index 0000000..5cf5f56 --- /dev/null +++ b/.htpasswd @@ -0,0 +1 @@ +admin:$apr1$0kT4lhp/$h8IeA/F7y4eUuBXFPKidj/ diff --git a/README.md b/README.md index 458a75a..54ed18f 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,22 @@ Started a [design podcast](https://anyway.fm/) couple of years ago, and in the v # 02. Usage - Put the XML file you wanna edit in the root and select it in the '**Settings**' panel and then you can edit / add episodes. -- There isn't any authentication or security check so please don't put it on the sever in case shit happens. -# 03. Change Log +# 03. Authentication + - There's a very simple authentication done with `.htaccess`, so all you gotta do is to generate the `.htpasswd` file content [in this site](http://www.htaccesstools.com/htpasswd-generator/) and replace it. + - The parameter **AuthUserFile** of the `.htaccess` file is the path to the `.htpasswd` that **must to be the real path** at all, if needed, change it. + - By default authentication is: user `admin` and password `admin` + +# 04. Change Log - [Feb 3, 2019] Updated the layout compatibility. - [Jul 27, 2017] Added ‘**Preview**’ function for episode link, image file and audio file. - [Dec 13, 2016] Added ‘**duplicate**’ and ‘**delete**’ functions. - [Jul 20, 2016] Added multi-language support: Simplified Chinese, Traditional Chinese, English. -# 04. Alternatives +# 05. Alternatives - [Itunes podcast XML generator](http://codepen.io/jon-walstedt/pen/jsIup) by Jon Wålstedt - [Podcast Generator](http://www.podcastgenerator.net/) - Any Podcast hosting services. -# 05. Credits +# 06. Credits - Some icons used are from the set [Squid Ink Line Icons](http://thesquid.ink/line-icons/) diff --git a/assets/logout.js b/assets/logout.js new file mode 100644 index 0000000..b57067c --- /dev/null +++ b/assets/logout.js @@ -0,0 +1,31 @@ + +/* + * This function will try to force browser to request + * login again, but it's not really confiable, so avoid + * to depend entirely on it. + */ +function logout() { + + var baseURL = window.location.origin+window.location.pathname; + + var xmlhttp; + if (window.XMLHttpRequest) { + xmlhttp = new XMLHttpRequest(); + } + // code for IE + else if (window.ActiveXObject) { + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + if (window.ActiveXObject) { + // IE clear HTTP Authentication + document.execCommand("ClearAuthenticationCache"); + window.location.href=baseURL; + } else { + xmlhttp.open("GET", baseURL+'assets/logout.js', true, "logout", "logout"); + xmlhttp.send(""); + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4) {window.location.href=baseURL;} + } + } + return false; +} diff --git a/index.php b/index.php index 9a48601..bbcfce6 100644 --- a/index.php +++ b/index.php @@ -10,6 +10,8 @@ + +
+