mirror of
https://github.com/SuperBFG7/ympd
synced 2024-12-23 01:20:27 +00:00
add manpage, jquery cookie plugin
This commit is contained in:
parent
4a4e8e2480
commit
5d9e70750d
114
htdocs/js/jquery.cookie.js
Normal file
114
htdocs/js/jquery.cookie.js
Normal file
@ -0,0 +1,114 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.0
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals.
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
54
ympd.1
Normal file
54
ympd.1
Normal file
@ -0,0 +1,54 @@
|
||||
.\" Manpage for ympd.
|
||||
.\" Contact andy@ympd.org to correct errors or typos.
|
||||
.TH man 8 "17 Jan 2014" "1.0" "ympd man page"
|
||||
.SH NAME
|
||||
ympd \- Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS
|
||||
.SH SYNOPSIS
|
||||
ympd [OPTION]...
|
||||
.SH DESCRIPTION
|
||||
ympd is a lightweight MPD (Music Player Daemon) web client that runs without a dedicated werbserver or interpreters like PHP, NodeJS or Ruby. It's tuned for minimal resource usage and requires only very litte dependencies.
|
||||
|
||||
ympd is based in part on the work of the libwebsockets project (http://libwebsockets.org)
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-host HOST\fR
|
||||
connect to mpd at host, defaults to localhost
|
||||
.TP
|
||||
\fB\-p\fR, \fB\-\-port PORT\fR
|
||||
connect to mpd at port, defaults to 6600
|
||||
.TP
|
||||
\fB\-i\fR, \fB\-\-interface INTERFACE\fR
|
||||
specifies the interface to listen to
|
||||
.TP
|
||||
\fB\-w\fR, \fB\-\-webport PORT\fR
|
||||
specifies the port for the webserver to listen to, defaults to 8080
|
||||
.TP
|
||||
\fB\-r\fR, \fB\-\-resourcepath PATH\fR
|
||||
resource path to htdocs directory, defaults to the supplied htdocs directory
|
||||
.TP
|
||||
\fB\-c\fR, \fB\-\-ssl_cert PATH\fR
|
||||
path the the ssl certificate
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-ssl_key PATH\fR
|
||||
path the the private ssl key
|
||||
.TP
|
||||
\fB\-u\fR, \fB\-\-uid UID\fR
|
||||
drop privileges to the provided uid after socket binding
|
||||
.TP
|
||||
\fB\-g\fR, \fB\-\-gid GID\fR
|
||||
drop privileges to the provided gid after socket binding
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-verbose [LEVEL]\fR
|
||||
sets the verbository level
|
||||
.TP
|
||||
\fB\-V\fR, \fB\-\-version\fR
|
||||
print version and exit
|
||||
.TP
|
||||
\fB\-\-help\fR
|
||||
print all valid options and exits
|
||||
.SH BUGS
|
||||
No known bugs.
|
||||
.SH AUTHOR
|
||||
Andrew Karpow (andy@ympd.org)
|
||||
|
||||
http://ympd.org
|
Loading…
Reference in New Issue
Block a user