# HG changeset patch # User Aleksej Bobylev # Date 1494451026 -10800 # Node ID 2aaf73fe2cd4d15ba9d359f08502d36e0e34f3a9 # Parent fe29568da760bac0dfb586b444de0e3152189bf2 Add lighttpd/*: this is for cook.slitaz.org Lighttpd-driven web interface. diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/README.md Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,68 @@ + + +index.cgi readme +================ + +This CGI script is intended to be used on the Lighttpd powered SliTaz web +server. The configuration uses the modules: + + * mod_rewrite: to have cacheable, reusable, human friendly URIs + * mod_compress: to save traffic + +Examples of human friendly URIs: + + * /busybox : the page contains all about busybox package + * /busybox/receipt : the page with the busybox's receipt + * /busybox/files : the page with the file listing + * /busybox/file/bin/busybox : get the specified file + * /get/busybox-1.26.2.tazpkg : get the specified package + +Example of traffic saving: + + * glibc.log in plain form: 8.3 MB + * glibc.log in compressed form: 0.3 MB (3% of the original size) + + +Notes about logs +---------------- + +Single resource should be associated with the discrete URI. But due to log +rotation, glibc.log.2 become glibc.log.3 after package rebuilding. In such +situation: + + 1. we can't point to the specified log and line within it (URI changed); + 2. caching will fail, already cached log change the name. + +The solution implemented is virtually append log name with the UNIX timestamp +of last modification of the log instead of sequental numbers. So, for example, +'glibc.log.2' will virtually became 'glibc.log.1482699768'. To found the matched +log we need to cycle among ten or less 'glibc.log*' physical files and compare +the files modification date with date in question. + + +Full list of implemented human friendly URIs +-------------------------------------------- + +URI syntax | Description | URI example +-----------------------|----------------------------------------|----------------------- +/ | cooker home page | / +/‹pkg› | brief info about ‹pkg› | /busybox +/‹pkg›/receipt | display ‹pkg› receipt | /busybox/receipt +/‹pkg›/description | display ‹pkg› description | /busybox/description +/‹pkg›/stuff/‹stuff› | display ‹stuff› file | /busybox/stuff/www/httpd/404.html +/‹pkg›/files | display ‹pkg› files list | /busybox/files +/‹pkg›/file/‹file› | get the ‹file› from the ‹pkg› | /busybox/file/bin/busybox +/get/‹package.tazpkg› | get the specified ‹package.tazpkg› | /get/busybox-1.26.2.tazpkg +/src/‹tarball› | get the specified sources ‹tarball› | /src/busybox-1.26.2.tar.bz2 +/‹pkg›/man | list of man pages, display default one | /cmark/man +/‹pkg›/man/‹page› | display specified man ‹page› | /cmark/man/cmark.1 +. | . | /man-db/man/es/mandb.8 +/‹pkg›/doc | list of existing documentation files | . +/‹pkg›/doc/‹doc› | display specified documentation file | . +/‹pkg›/info | list of existing info files | . +/‹pkg›/info/‹info› | display specified info file | . +/‹pkg›/log | display the latest cooking log | /busybox/log +/‹pkg›/log/‹timestamp› | display the specified cooking log | /busybox/log/1482700678 + + +((unfinished)) diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/cooker-emerald.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/cooker-emerald.css Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,6 @@ +@import url("cooker.css"); +html,body{background-color:palegreen} +header{background:repeating-linear-gradient(135deg,hsla(100,100%,20%,.7),hsla(100,100%,20%,.7) 10px,hsla(100,50%,20%,.7) 10px,hsla(100,50%,20%,.7) 20px),repeating-linear-gradient(45deg,hsla(100,100%,20%,.7),hsla(100,100%,20%,.7) 10px,hsla(100,50%,20%,.7) 10px,hsla(100,50%,20%,.7) 20px)} +header{text-shadow:0 3px 3px #000} +.log u{color:olive} +header h1::before{content: url("data:image/svg+xml,")} diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/cooker-goldenrod.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/cooker-goldenrod.css Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,7 @@ +@import url("cooker.css"); +html,body{background-color:palegoldenrod} +progress::-moz-progress-bar{background-color:hsla(30,60%,40%,.7)} +progress::-webkit-progress-value{background-color:hsla(30,60%,40%,.7)} +header{background-color:hsla(40,70%,50%,.7);color:#000;box-shadow:0 -3px 0 rgba(0,0,0,.3) inset} +header a{color:rgba(0,0,0,.7)} +header a:hover{color:rgba(0,0,0,.8);text-shadow:0 0 4px rgba(0,0,0,.5)} diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/cooker-like2016.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/cooker-like2016.css Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,168 @@ +/* CSS style for SliTaz Cooker */ + +html { min-height: 102%; } +body { font: 13px sans-serif, vernada, arial; margin: 0; } +h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; } +h1 a { color: #fff; text-decoration: none; } +h2 { color: #444; } +h3 { color: #666; font-size: 140%; } +a { text-decoration: underline; color: #215090; } +a:hover { text-decoration: none; } +hr { margin: 0; border: 1px solid #cfcfcf; } +pre, table { + background-color: #f8f8f8; + border: 1px solid #ddd; + padding: 10px; + overflow: auto; + font-size: 96%; + font-family: monospace; +} +pre .underline { display: none; } + + +/* Header */ + +header { + color: #fff; + background: #222; + height: 40px; + border-bottom: 4px solid #afafaf; +} +header h1::before { + content: ''; + display: inline-block; + background: url("/images/logo.png") no-repeat left; + width: 40px; + height: 40px; + vertical-align: middle; +} + +header h1 { + margin: 0; + padding: 0; + white-space: nowrap; + float: left; +} + +header h1 a { + color: #fff; + text-decoration: none; + font-size: 20px; + font-style: italic; +} + +header h1 a:hover, #network a:hover { + color: #afafaf; +} + +/* Header links */ + +.network { + float: right; + padding: 14px 5px 0; + font-size: 12px; +} + +.network a { + padding: 0 4px; + color: #fff; + font-weight: bold; + text-decoration: none; +} + +/* Content */ + +main { + margin: 40px 80px; + text-align: justify; +} +.r { float: right; } +form button[type='submit'] { display: none; } +table { width: 100%; } +td { padding: 0; } +td:first-child { white-space:nowrap; width:5rem; } +table td:nth-child(2)::before { content:' : '; } +.activity .r { display: none; } +.log a[name] { text-decoration: none; } + +.span-ok { color: #0a0; } +.span-red { color: red; } +.span-sky { color: blue; } +.span-no { color: #d90; } +.span-line { color: #888; } +.log-date { color: #666; font-size: 95%; } +.sh-comment { color: #a00; } +.sh-val { color: #e50; font-weight: bold; } +.var { color: #05a; } + +/* Colored log */ + +.log b { font-weight: normal; color: red; } +.log u { text-decoration: none; color: darkorange; } +.log i { font-style: normal; color: green; } +.log em { font-style: normal; } + +/* Buttons */ + +.button { + cursor: pointer; + padding: 4px; + margin: 4px 0px; + display: inline-block; +} + +a.button, .meter span { + text-decoration: none; + color: #666; +} + +.button:hover { + border: 1px solid #999; +} + +progress { + width: 100%; + box-sizing: border-box; + margin: 0; + padding: 0; + height: 23px; +} +.meter { height: 23px; overflow: hidden; } +progress::-webkit-progress-bar { background: #9dff4a; } +progress::-webkit-progress-value { background: #9dff4a; } +progress::-moz-progress-bar { background: #9dff4a; } +.meter span { + display: block; + position: relative; + margin: -20px 6px; +} + +.button, progress { + border: 1px solid #cccccc; + font-size: 14px; + line-height: 1.2em; + background-image: -webkit-linear-gradient(#FAFAFA, #F4F4F4 40%, #E5E5E5); + background-image: -moz-linear-gradient(#FAFAFA, #F4F4F4 40%, #E5E5E5); + -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); +} + +/* Round corner */ + +pre, .button, progress, table { + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +/* Footer */ + +footer { + text-align: center; + padding: 20px; + border-top: 1px solid #ddd; + font-size: 90%; +} + +footer a { padding: 0 2px; } diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/cooker-sky.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/cooker-sky.css Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,8 @@ +@import url("cooker.css"); +html,body{background-color:powderblue} +progress::-moz-progress-bar{background-color:hsla(200,100%,40%,0.7)} +progress::-webkit-progress-value{background-color:hsla(200,100%,40%,0.7)} +header{background:none} +header{background: url("data:image/svg+xml,") repeat-x;background-color:#6495ED} +header a,header a:hover{color:hsla(250,100%,20%,.7)} +header a:hover{text-shadow:0 0 4px hsla(0,0%,100%,.9)} diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/cooker-terminal.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/cooker-terminal.css Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,279 @@ +/* CSS style for SliTaz Cooker */ + +*{font:14px/18px monospace;margin:0;padding:0} +html,body{height:100%;color:#888;background-color:#000} +#container { + position: relative; + min-height: 100%; + margin: 0 auto; +} + + +/* HEADER */ + +header,body>h2{background-color:#333} +header h1{display:inline-block;padding:18px 0} +header h1,body>h2{white-space:nowrap} +body>h2{padding:1rem 0} +header h1::before{content:'#! '} +header a,body>h2{color:#CCC} +.network{float:right} +.network a{padding:18px 8px 18px 0} +header select, header option { + background-color: transparent; + color: inherit; + border: none; +} + + +/* FOOTER */ + +footer, div.foot { + padding: 18px 0; + clear: both; + text-align: center; + color: #CCC; + background-color: #333; + + position: absolute; + bottom: 0; + width: 100%; +} +footer a+a::before { + display: inline-block; + content: ' • '; + color: #E81; +} + + +/* CONTENT */ + +h2,h3{font-weight:bold;background-color:#333} +h2::before,h3::before{content:'#'} +h2{color:#F0F} +h3{color:#FF0} +a{display:inline-block;text-decoration:none;color:#00F} +a:hover,body>h2:hover{text-decoration:underline} +pre { + background-color: rgba(0,0,0,0.03); + border: 1px solid rgba(0,0,0,0.1); + margin: 18px 0 0; + overflow: auto; + font: 13px/18px monospace; +} +li::before{content:'  * '} +p{margin-top:18px} + +main{margin:auto;padding:0 0 54px} +section{margin-bottom:18px} +#content2, div.list { + width: 100%; box-sizing: border-box; + max-width: 700px; + margin: auto; + padding: 18px 0; +} +#info{margin:18px 0} + +.btnList{margin-bottom:18px} + +.span-ok { color: #0a0; } +.span-red { color: red; } +.span-sky { color: blue; } +.span-no { color: #d90; } +.span-line { color: #888; } +.log-date { color: #666; font-size: 95%; } +.sh-comment { color: #a00; } +.sh-val { color: #e50; font-weight: bold; } +.var { color: #05a; } + + +/* Colored log */ + +.log b { font-weight: normal; color: red; } +.log u { text-decoration: none; color: darkorange; } +.log i { font-style: normal; color: green; } +.log em { font-style: normal; background-color: lightsteelblue; font-weight: bold; display: inline-block; width: 100%; } + + + +/* Buttons */ + +.button,button{color:#888} +.button::before,button::before{content:'['} +.button::after,button::after{content:']'} +.button.active { + color: inherit; + border: none; + text-decoration: none; +} +.button:hover, button:hover, input:hover { + color: #FFF; + text-decoration: none; +} +.button[data-acc]::before { + content: attr(data-acc); + padding:0 8px; + background-color: orange; + color: #000; + display: inline-block; + text-transform: uppercase; +} +.btnList .button::after{content:''} + + +/* Search box */ + +.search input{font-size:inherit;font-family:inherit;color:inherit;border:none;height:inherit} +.search button{border:0;height:inherit;float:right;background:transparent;cursor:pointer} + + + + + +.log a[name]{text-decoration:none;color:#666} +.log a[name]:hover{color:#FFF} + +.r{float:right} + +[class*="bigicon-"] { + margin: 0.5rem 0; + padding: 1rem 0.8rem 1rem 3rem; + background-color: hsla(0,0%,100%,0.8); + box-shadow: 0 0 3px rgba(0,0,0,0.4); +} + + +a:target { background-color: yellow; } + + +/* Table */ + +table{width:100%;box-sizing:border-box;border-collapse:collapse} +td{vertical-align:top} +td:first-child{white-space:nowrap;width:5rem} +td+td,th+th { border-left: 1px solid rgba(0,0,0,0.1); } +.activity td:first-child, .cooknotes td:first-child, td.m { color: #444; } +table td:nth-child(2)::before{content:': '} +.activity .r.c20::after{content:'  '} + +div.list td, div.list th { padding: 5px 2px; } + +.texinfo pre { display: none; } +.texinfo pre:target { display: block; } + + +/* HTML5 progress */ + +.meter{height:18px} +.meter progress { + height: inherit; + width: 100%; + display: inline-block; + vertical-align: middle; + border: none; +} +progress { + border: 1px solid rgba(0,0,0,0.2); + background-color: hsla(0,0%,100%,0.6); + box-shadow: inset 0 0 4px rgba(0,0,0,0.1); + -webkit-transition: all .5s; transition: all .5s; +} +progress::-webkit-progress-bar { + background-color: hsla(0,0%,100%,0.6); + box-shadow: inset 0 0 4px rgba(0,0,0,0.1); +} +progress::-webkit-progress-value { + background-color: hsla(100,100%,40%,0.7); + -webkit-transition: all .5s; transition: all .5s; +} +progress::-moz-progress-bar { + background-color: hsla(100,100%,40%,0.7); + transition: all .5s; +} +.meter span { + display: block; + white-space: nowrap; + position: relative; + margin-top: -18px; + text-align: center; + color: #000; +} + + + + +/* Documents iframe */ + +iframe { + border: none; +} + + +/* Terminal colors */ + +pre.files { background-color: hsla(0,0%,0%,0.8); color: hsla(0,0%,100%,0.9); } +pre.files a { text-decoration: none; } +.c00 { color: #d3d7cf; } .c01 { color: #555753; } +.c10 { color: #cc0000; } .c11 { color: #ef2929; } +.c20 { color: #4e9a06; } .c21 { color: #8ae234; } +.c30 { color: #c4a000; } .c31 { color: #fce94f; } +.c40 { color: #3465a4; } .c41 { color: #729fcf; } +.c50 { color: #75507b; } .c51 { color: #ad7fa8; } +.c60 { color: #06989a; } .c61 { color: #34e2e2; } +.c70 { color: #2e3436; } .c71 { color: #eeeeec; } +.c01,.c11,.c21,.c31,.c41,.c51,.c61,.c71 { font-weight: bold; } + +/* Old webkit-gtk compatibility */ + +header, footer, main { + display: block; +} + + +/* FOLLOWING CSS HAS SOME CHANGES FOR SLITAZ COOKER! */ + +/* http://prismjs.com/download.html?themes=prism-okaidia&languages=markup+css+clike+javascript+asciidoc+bash+c+css-extras+diff+ini+markdown+perl+python */ +/** + * okaidia theme for JavaScript, CSS and HTML + * Loosely based on Monokai textmate theme by http://www.monokai.nl/ + * @author ocodia + */ +code[class*="language-"], pre[class*="language-"] { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0,0,0,0.3); + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; + -webkit-hyphens: none; -moz-hyphens: none; hyphens: none; +} +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} +:not(pre) > code[class*="language-"], pre[class*="language-"] { + background: #272822; +} +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + white-space: normal; +} +.token.comment,.token.prolog,.token.doctype,.token.cdata{color:slategray;} +.token.punctuation{color:#f8f8f2;} +.namespace{opacity:.7;} +.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted{color:#f92672;} +.token.boolean,.token.number,.token.coord{color:#ae81ff;} +.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#a6e22e;} +.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable{color:#f8f8f2;} +.token.atrule,.token.attr-value,.token.function{color:#e6db74;} +.token.keyword{color:#66d9ef;} +.token.regex,.token.important{color:#fd971f;} +.token.important,.token.bold{font-weight:bold;} +.token.italic{font-style:italic;} +.token.entity{cursor:help;} diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/cooker.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/cooker.css Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,463 @@ +/* CSS style for SliTaz Cooker */ + +html, body { + height: 100%; + margin: 0; + font: 14px/18px sans-serif; + color: rgba(0,0,0,0.9); + background-color: hsl(0, 0%, 98%); +} +#container { + position: relative; + min-height: 100%; + margin: 0 auto; +} + + +/* HEADER */ + +header, body>h2 { + background-color: rgba(0,0,0,0.7); + text-align: justify; + box-shadow: 0 -8px 8px rgba(0,0,0,0.3) inset; + line-height: 0; +} +header::before, header::after { + display: inline-block; + width: 100%; + overflow: hidden; height: 0; content: ''; visibility: hidden; +} +header h1 { + display: inline-block; +} +header h1, body>h2 { + margin: auto 0; + box-sizing: border-box; + white-space: nowrap; + vertical-align: middle; +} +body>h2 { + padding: 5px 0; +} +header h1::before, body>h2::before { + display: inline-block; + content: url("data:image/svg+xml,"); + vertical-align: middle; +} +header a, body>h2 { + color: hsla(0, 0%, 100%, 0.7); + -webkit-transition: .2s text-shadow; transition: .2s text-shadow; + text-decoration: none; +} +header a:hover, body>h2:hover { + color: hsla(0, 0%, 100%, 1); + text-shadow: 0 0 4px hsla(0, 0%, 100%, 0.5); + text-decoration: none; +} +header h1 a, body>h2 { + font: bold italic 20px/20px sans-serif; +} +.network { + display: inline-block; + text-align: left; + vertical-align: middle; + font-size: 12px; + line-height: normal; + color: #999; +} +.network a { + display: inline-block; + padding: 8px 6px; + vertical-align: middle; +} +header select, header option { + background-color: transparent; + color: inherit; + border: none; + font-size: inherit; +} + + +/* FOOTER */ + +footer, div.foot { + padding: 20px 0; + clear: both; + text-align: center; + font-size: 90%; + color: #666; + background-color: hsla(0, 0%, 20%, 0.1); + box-shadow: 0 4px 8px hsla(0, 0%, 0%, 0.2) inset; + + position: absolute; + bottom: 0; + width: 100%; +} +footer a+a::before { + display: inline-block; + content: ' • '; + color: #E81; +} +footer div { + margin: 12px; +} + + + +/* CONTENT */ + +h2 { + margin: 0; padding: 0.2rem; + font: bold 1.3rem/2rem sans-serif; + color: rgba(0,0,0,0.7); +} +section h2, section h3 { + background-color: rgba(0,0,0,0.05); + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} +h3 { + margin: 0; padding: 0.2rem; + font: bold 1.15rem/1.5rem sans-serif; + color: rgba(0,0,0,0.6); +} +a { + text-decoration: none; + color: hsl(215, 60%, 40%); + -webkit-transition: .2s border-color, .2s box-shadow; transition: .2s border-color, .2s box-shadow; + border-bottom: 1px solid transparent; +} +main td a:hover, p a:hover { + text-decoration: none; + color: hsl(215, 100%, 40%); + border-color: hsl(215, 100%, 40%); +} +pre { + background-color: rgba(0,0,0,0.03); + border: 1px solid rgba(0,0,0,0.1); + padding: 8px; + margin: 0; + overflow: auto; + font: 13px/16px monospace; +} +pre .underline { border-bottom: 1px solid #444; display: block; right: 0; } + +/* Content */ + +main { + margin: auto; + padding: 0.5em 0.5em 5em; +} +#content2, div.list { + width: 100%; box-sizing: border-box; + max-width: 700px; + margin: auto; + padding: 0.5em; +} + + +.span-ok { color: #0a0; } +.span-red { color: red; } +.span-sky { color: blue; } +.span-no { color: #d90; } +.span-line { color: #888; } +.log-date { color: #666; font-size: 95%; } +.sh-comment { color: #a00; } +.sh-val { color: #e50; font-weight: bold; } +.var { color: #05a; } + + +/* Colored log */ + +.log b { font-weight: normal; color: red; } +.log u { text-decoration: none; color: darkorange; } +.log i { font-style: normal; color: green; } +.log em { font-style: normal; background-color: lightsteelblue; font-weight: bold; display: inline-block; width: 100%; } + + + +/* Buttons */ + +.button { + display: inline-block; + padding: 4px; + margin: 2px 0; + text-decoration: none; + color: rgba(0,0,0,0.7); + border: 1px solid; + border-color: rgba(0,0,0,0.3) rgba(0,0,0,0.5) rgba(0,0,0,0.5) rgba(0,0,0,0.3); + -moz-user-select: none; +} +.button.active { + color: inherit; + padding: 5px; + border: none; + box-shadow: 0 0 3px rgba(0,0,0,0.7) inset; + text-decoration: none; +} +.button:not(.active):hover, input:hover { + color: inherit; + box-shadow: 0 0 4px rgba(0,0,0,0.3); + text-decoration: none; + outline: none; +} +.button[data-acc]::before { + content: attr(data-acc); + display: inline-block; + padding-right: 4px; + margin-right: 4px; + text-align: center; + text-transform: uppercase; + border-right: 1px solid; + border-color: inherit; +} + + +/* Search box */ + +.search input { + padding: 2px; + font-size: inherit; + font-family: inherit; + color: inherit; + border: 1px solid rgba(0,0,0,0.3); + -webkit-transition: .2s box-shadow, .5s padding cubic-bezier(.68,-0.55,.27,1.55); + transition: .2s box-shadow, .5s padding cubic-bezier(.68,-0.55,.27,1.55); + float: right; + height: 28px; + box-sizing: border-box; +} +.search input:focus { + padding-right: 22px; +} +.search button { + background: transparent url("data:image/svg+xml,") no-repeat 0 0; + border: 0; + width: 19px; + height: 19px; + text-indent: -99999px; + margin-left: -22px; + margin-top: 6px; + padding: 0; + opacity: 0.6; + cursor: pointer; + float: right; +} + + +/* Round corner */ + +pre, .button, .search input, [class*="bigicon-"], progress { + border-radius: 3px; +} + + + +.log a[name] { text-decoration: none; color: #666; } +.log a[name]:hover { color: #000; } + +.r { float: right; } +form.r, .button.r { margin: 3px 3px 0; } + +.button.r { background-color: white; } +.button.receipt { background-color: greenyellow; } +.button.website { background-color: skyblue; } +.button.files { background-color: khaki; } +.button.desc { background-color: sandybrown; } +.button.download { background-color: gold; } +.button.source { background-color: yellow; } +.button.browse { background-color: tan; } +.button.doc { background-color: plum; } +.button.log { background-color: lightgray; } + +.icon::before { + height: 16px; + vertical-align: -2px; + display: inline-block; + padding-right: 2px; + opacity: 0.6; +} +.icon.receipt::before { content: url("data:image/svg+xml,"); } +.icon.website::before { content: url("data:image/svg+xml,"); } +.icon.files::before { content: url("data:image/svg+xml,"); } +.icon.desc::before { content: url("data:image/svg+xml,"); } +.icon.download::before, .icon.source::before { content: url("data:image/svg+xml,"); } +.icon.browse::before { content: url("data:image/svg+xml,"); } +.icon.doc::before { content: url("data:image/svg+xml,"); } +.icon.log::before { content: url("data:image/svg+xml,"); } +.icon.more::before { content: url("data:image/svg+xml,"); } +.icon.bell::before { content: url("data:image/svg+xml,"); } + +.bigicon-i { + background: url("data:image/svg+xml,") no-repeat 0.5rem 50%; +} +.bigicon-w { + background: url("data:image/svg+xml,") no-repeat 0.5rem 50%; +} +.bigicon-e { + background: url("data:image/svg+xml,") no-repeat 0.5rem 50%; +} +[class*="bigicon-"] { + margin: 0.5rem 0; + padding: 1rem 0.8rem 1rem 3rem; + background-color: hsla(0,0%,100%,0.8); + box-shadow: 0 0 3px rgba(0,0,0,0.4); +} + + +a:target { background-color: yellow; } + + +/* Table */ + +table { width: 100%; box-sizing: border-box; border-collapse: collapse; /*box-shadow: 0 0 4px rgba(0,0,0,0.3);*/ } +th { background-color: rgba(0,0,0,0.2); padding: 3px; } +td { padding: 2px; vertical-align: top; } +td:first-child { white-space: nowrap; width: 5rem; } +td+td, th+th { border-left: 1px solid rgba(0,0,0,0.1); } +.activity td:first-child, .cooknotes td:first-child, td.m { color: rgba(0,0,0,0.6); } + +tbody tr:nth-child(odd) { + background-color: hsla(0, 0%, 100%, 0.3); +} +tbody tr:nth-child(even) { + background-color: hsla(0, 0%, 0%, 0.05); +} + + + +div.list td, div.list th { padding: 5px 2px; } + +.texinfo pre { display: none; } +.texinfo pre:target { display: block; } + +section, div.list { + margin: 0.6rem 0; + padding: 4px; + box-shadow: 0 0 4px rgba(0,0,0,0.3); + border-radius: 4px; +} +div.list { + margin: 2rem auto; +} + + +/* HTML5 progress */ + +.meter { + height: 1.4rem; + color: inherit; +} +.meter progress { + height: inherit; + width: 100%; + box-sizing: border-box; + display: inline-block; + vertical-align: middle; +} +progress { + border: 1px solid rgba(0,0,0,0.2); + background-color: hsla(0,0%,100%,0.6); + box-shadow: inset 0 0 4px rgba(0,0,0,0.1); + -webkit-transition: all .5s; transition: all .5s; +} +progress::-webkit-progress-bar { + background-color: hsla(0,0%,100%,0.6); + box-shadow: inset 0 0 4px rgba(0,0,0,0.1); +} +progress::-webkit-progress-value { + background-color: hsla(100,100%,40%,0.7); + -webkit-transition: all .5s; transition: all .5s; +} +progress::-moz-progress-bar { + background-color: hsla(100,100%,40%,0.7); + transition: all .5s; +} +.meter span { + display: block; + white-space: nowrap; + position: relative; + margin: -1.3rem auto 0 0.1rem; + text-align: center; +} + + + + +/* Documents iframe */ + +iframe { + border: none; +} + + +/* Terminal colors */ + +pre.files { background-color: hsla(0,0%,0%,0.8); color: hsla(0,0%,100%,0.9); } +pre.files a { text-decoration: none; } +pre.files a:hover { text-decoration: underline; } +.c00 { color: #d3d7cf; } .c01 { color: #555753; } +.c10 { color: #cc0000; } .c11 { color: #ef2929; } +.c20 { color: #4e9a06; } .c21 { color: #8ae234; } +.c30 { color: #c4a000; } .c31 { color: #fce94f; } +.c40 { color: #3465a4; } .c41 { color: #729fcf; } +.c50 { color: #75507b; } .c51 { color: #ad7fa8; } +.c60 { color: #06989a; } .c61 { color: #34e2e2; } +.c70 { color: #2e3436; } .c71 { color: #eeeeec; } +.c01,.c11,.c21,.c31,.c41,.c51,.c61,.c71 { font-weight: bold; } + +/* Old webkit-gtk compatibility */ + +header, footer, main { + display: block; +} + + +/* FOLLOWING CSS HAS SOME CHANGES FOR SLITAZ COOKER! */ + +/* http://prismjs.com/download.html?themes=prism-okaidia&languages=markup+css+clike+javascript+asciidoc+bash+c+css-extras+diff+ini+markdown+perl+python */ +/** + * okaidia theme for JavaScript, CSS and HTML + * Loosely based on Monokai textmate theme by http://www.monokai.nl/ + * @author ocodia + */ +code[class*="language-"], pre[class*="language-"] { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0,0,0,0.3); + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; + -webkit-hyphens: none; -moz-hyphens: none; hyphens: none; +} +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} +:not(pre) > code[class*="language-"], pre[class*="language-"] { + background: #272822; +} +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} +.token.comment,.token.prolog,.token.doctype,.token.cdata{color:slategray;} +.token.punctuation{color:#f8f8f2;} +.namespace{opacity:.7;} +.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted{color:#f92672;} +.token.boolean,.token.number,.token.coord{color:#ae81ff;} +.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#a6e22e;} +.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable{color:#f8f8f2;} +.token.atrule,.token.attr-value,.token.function{color:#e6db74;} +.token.keyword{color:#66d9ef;} +.token.regex,.token.important{color:#fd971f;} +.token.important,.token.bold{font-weight:bold;} +.token.italic{font-style:italic;} +.token.entity{cursor:help;} diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/cooker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/cooker.js Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,105 @@ +// +// Set of scripts for SliTaz Cooker +// that make the better user interaction with it +// + + +// Start updating percents of package completion + +function startUpdating(pkg) { + upID = setInterval(function() { + var upct = new XMLHttpRequest(); + upct.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + response = this.responseText.trim(); + if (response == 'reload') { + // Package in question not cooked now (finished) -> + // Server sends 'reload' response -> + // Stop updating and reload the page + clearInterval(upID); + location.reload(); + } else { + // Update text and gauge value + var pct = document.getElementById('pct'); + if (pct !== null) pct.innerHTML = response + '%'; + var gauge = document.getElementById('gauge'); + if (gauge !== null) gauge.value = response; + } + } + }; + upct.open('GET', '?pct=' + pkg, true); + upct.responseType = 'text'; + upct.send(); + }, 10000); +} + + +// Stop updating percents of package completion + +function stopUpdating() { + clearInterval(upID); + // Also remove the table row containing gauge because it will be no actual anymore + document.getElementById('pct').innerHTML = ''; + // first "parentElement" of gauge is , second - is + document.getElementById('gauge').parentElement.parentElement.remove(); +} + + +// Decide whether we need to update percentage + +if (typeof updatePkg !== 'undefined') + startUpdating(updatePkg); + + +// Calculate and show server date + +function calcAndShowDate() { + var serverDateNow = new Date() - deltaTime; + var serverDateString = new Date(serverDateNow).toISOString(); + // Format string in form 'YYYY-mm-dd HH:MM UTC' + document.getElementById('date').innerHTML = serverDateString.substring(0, 10) + ' ' + serverDateString.substring(11, 16) + ' UTC'; +} + + +// Update "server date" on the page +// First, wait for the next minute beginning, update once, then update every minute + +function refreshDate(firstWait, serverTimeMs) { + deltaTime = new Date() - serverTimeMs; + var id1 = setTimeout(function() { + calcAndShowDate(); + var id2 = setInterval(calcAndShowDate, 60000); + }, firstWait); +} + + +// Resize the iframe containing document to fit it's height without scrolling + +function resizeIframe(theframe) { + var height = theframe.contentWindow.document.body.scrollHeight; + // Limit height for VERY long documents (lua->doc->manual.html) + // because TazWeb fails on this + if ( height > 20000 ) { + height = 480; + theframe.focus(); + } + theframe.style.height = height + 'px'; +} + + +/* http://prismjs.com/download.html?themes=prism-okaidia&languages=markup+css+clike+javascript+asciidoc+bash+c+css-extras+diff+ini+makefile+markdown+perl+python */ +var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(v instanceof a)){u.lastIndex=0;var b=u.exec(v),k=1;if(!b&&h&&m!=r.length-1){if(u.lastIndex=y,b=u.exec(e),!b)break;for(var w=b.index+(c?b[1].length:0),_=b.index+b[0].length,P=m,A=y,j=r.length;j>P&&_>A;++P)A+=r[P].length,w>=A&&(++m,y=A);if(r[m]instanceof a||r[P-1].greedy)continue;k=P-m,v=e.slice(y,A),b.index-=y}if(b){c&&(f=b[1].length);var w=b.index+f,b=b[0].slice(f),_=w+b.length,x=v.slice(0,w),O=v.slice(_),S=[m,k];x&&S.push(x);var N=new a(i,g?n.tokenize(b,g):b,d,b,h);S.push(N),O&&S.push(O),Array.prototype.splice.apply(r,S)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(o?" "+o:"")+">"+l.content+""},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,!document.addEventListener||n.manual||r.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); +Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup; +Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); +Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; +Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript; +!function(a){var i={pattern:/(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\]\\]|\\.)*\]|[^\]\\]|\\.)*\]/m,lookbehind:!0,inside:{quoted:{pattern:/([$`])(?:(?!\1)[^\\]|\\.)*\1/,inside:{punctuation:/^[$`]|[$`]$/}},interpreted:{pattern:/'(?:[^'\\]|\\.)*'/,inside:{punctuation:/^'|'$/}},string:/"(?:[^"\\]|\\.)*"/,variable:/\w+(?==)/,punctuation:/^\[|\]$|,/,operator:/=/,"attr-value":/(?!^\s+$).+/}};a.languages.asciidoc={"comment-block":{pattern:/^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,alias:"comment"},table:{pattern:/^\|={3,}(?:(?:\r?\n|\r).*)*?(?:\r?\n|\r)\|={3,}$/m,inside:{specifiers:{pattern:/(?!\|)(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*])?(?:[<^>](?:\.[<^>])?|\.[<^>])?[a-z]*)(?=\|)/,alias:"attr-value"},punctuation:{pattern:/(^|[^\\])[|!]=*/,lookbehind:!0}}},"passthrough-block":{pattern:/^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^\++|\++$/}},"literal-block":{pattern:/^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^(?:-+|\.+)|(?:-+|\.+)$/}},"other-block":{pattern:/^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/}},"list-punctuation":{pattern:/(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im,lookbehind:!0,alias:"punctuation"},"list-label":{pattern:/(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im,lookbehind:!0,alias:"symbol"},"indented-block":{pattern:/((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/,lookbehind:!0},comment:/^\/\/.*/m,title:{pattern:/^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} +.+|^\.(?![\s.]).*/m,alias:"important",inside:{punctuation:/^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/}},"attribute-entry":{pattern:/^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m,alias:"tag"},attributes:i,hr:{pattern:/^'{3,}$/m,alias:"punctuation"},"page-break":{pattern:/^<{3,}$/m,alias:"punctuation"},admonition:{pattern:/^(?:TIP|NOTE|IMPORTANT|WARNING|CAUTION):/m,alias:"keyword"},callout:[{pattern:/(^[ \t]*)/m,lookbehind:!0,alias:"symbol"},{pattern:/<\d+>/,alias:"symbol"}],macro:{pattern:/\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:{"function":/^[a-z\d-]+(?=:)/,punctuation:/^::?/,attributes:{pattern:/(?:\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:i.inside}}},inline:{pattern:/(^|[^\\])(?:(?:\B\[(?:[^\]\\"]|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?: ['`]|.)+?(?:(?:\r?\n|\r)(?: ['`]|.)+?)*['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"]|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m,lookbehind:!0,inside:{attributes:i,url:{pattern:/^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/,inside:{punctuation:/^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/}},"attribute-ref":{pattern:/^\{.+\}$/,inside:{variable:{pattern:/(^\{)[a-z\d,+_-]+/,lookbehind:!0},operator:/^[=?!#%@$]|!(?=[:}])/,punctuation:/^\{|\}$|::?/}},italic:{pattern:/^(['_])[\s\S]+\1$/,inside:{punctuation:/^(?:''?|__?)|(?:''?|__?)$/}},bold:{pattern:/^\*[\s\S]+\*$/,inside:{punctuation:/^\*\*?|\*\*?$/}},punctuation:/^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/}},replacement:{pattern:/\((?:C|TM|R)\)/,alias:"builtin"},entity:/&#?[\da-z]{1,8};/i,"line-continuation":{pattern:/(^| )\+$/m,lookbehind:!0,alias:"punctuation"}},i.inside.interpreted.inside.rest={macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity},a.languages.asciidoc["passthrough-block"].inside.rest={macro:a.languages.asciidoc.macro},a.languages.asciidoc["literal-block"].inside.rest={callout:a.languages.asciidoc.callout},a.languages.asciidoc.table.inside.rest={"comment-block":a.languages.asciidoc["comment-block"],"passthrough-block":a.languages.asciidoc["passthrough-block"],"literal-block":a.languages.asciidoc["literal-block"],"other-block":a.languages.asciidoc["other-block"],"list-punctuation":a.languages.asciidoc["list-punctuation"],"indented-block":a.languages.asciidoc["indented-block"],comment:a.languages.asciidoc.comment,title:a.languages.asciidoc.title,"attribute-entry":a.languages.asciidoc["attribute-entry"],attributes:a.languages.asciidoc.attributes,hr:a.languages.asciidoc.hr,"page-break":a.languages.asciidoc["page-break"],admonition:a.languages.asciidoc.admonition,"list-label":a.languages.asciidoc["list-label"],callout:a.languages.asciidoc.callout,macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity,"line-continuation":a.languages.asciidoc["line-continuation"]},a.languages.asciidoc["other-block"].inside.rest={table:a.languages.asciidoc.table,"list-punctuation":a.languages.asciidoc["list-punctuation"],"indented-block":a.languages.asciidoc["indented-block"],comment:a.languages.asciidoc.comment,"attribute-entry":a.languages.asciidoc["attribute-entry"],attributes:a.languages.asciidoc.attributes,hr:a.languages.asciidoc.hr,"page-break":a.languages.asciidoc["page-break"],admonition:a.languages.asciidoc.admonition,"list-label":a.languages.asciidoc["list-label"],macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity,"line-continuation":a.languages.asciidoc["line-continuation"]},a.languages.asciidoc.title.inside.rest={macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity},a.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))})}(Prism); +!function(e){var t={variable:[{pattern:/\$?\(\([\w\W]+?\)\)/,inside:{variable:[{pattern:/(^\$\(\([\w\W]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\([^)]+\)|`[^`]+`/,inside:{variable:/^\$\(|^`|\)$|`$/}},/\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i]};e.languages.bash={shebang:{pattern:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,alias:"important"},comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g,lookbehind:!0,greedy:!0,inside:t},{pattern:/(["'])(?:\\\\|\\?[^\\])*?\1/g,greedy:!0,inside:t}],variable:t.variable,"function":{pattern:/(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,lookbehind:!0},keyword:{pattern:/(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/,lookbehind:!0},"boolean":{pattern:/(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/,lookbehind:!0},operator:/&&?|\|\|?|==?|!=?|<<>|<=?|>=?|=~/,punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];]/};var a=t.variable[1].inside;a["function"]=e.languages.bash["function"],a.keyword=e.languages.bash.keyword,a.boolean=e.languages.bash.boolean,a.operator=e.languages.bash.operator,a.punctuation=e.languages.bash.punctuation}(Prism); +Prism.languages.c=Prism.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/\-[>-]?|\+\+?|!=?|<>?=?|==?|&&?|\|?\||[~^%?*\/]/,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,lookbehind:!0},directive:{pattern:/(#\s*)\b(define|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,lookbehind:!0,alias:"keyword"}}},constant:/\b(__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|stdin|stdout|stderr)\b/}),delete Prism.languages.c["class-name"],delete Prism.languages.c["boolean"]; +Prism.languages.css.selector={pattern:/[^\{\}\s][^\{\}]*(?=\s*\{)/,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+(?:\(.*\))?/,"class":/\.[-:\.\w]+/,id:/#[-:\.\w]+/,attribute:/\[[^\]]+\]/}},Prism.languages.insertBefore("css","function",{hexcode:/#[\da-f]{3,6}/i,entity:/\\[\da-f]{1,8}/i,number:/[\d%\.]+/}); +Prism.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d+.*$/m],deleted:/^[-<].*$/m,inserted:/^[+>].*$/m,diff:{pattern:/^!(?!!).+$/m,alias:"important"}}; +Prism.languages.ini={comment:/^[ \t]*;.*$/m,selector:/^[ \t]*\[.*?\]/m,constant:/^[ \t]*[^\s=]+?(?=[ \t]*=)/m,"attr-value":{pattern:/=.*/,inside:{punctuation:/^[=]/}}}; +Prism.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|.)*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},builtin:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,symbol:{pattern:/^[^:=\r\n]+(?=\s*:(?!=))/m,inside:{variable:/\$+(?:[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:[/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,{pattern:/(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/,lookbehind:!0}],operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}; +Prism.languages.markdown=Prism.languages.extend("markup",{}),Prism.languages.insertBefore("markdown","prolog",{blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},code:[{pattern:/^(?: {4}|\t).+/m,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*(?:\r?\n|\r)(?:==+|--+)/,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#+.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])([\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:/(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^\*\*|^__|\*\*$|__$/}},italic:{pattern:/(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^[*_]|[*_]$/}},url:{pattern:/!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,inside:{variable:{pattern:/(!?\[)[^\]]+(?=\]$)/,lookbehind:!0},string:{pattern:/"(?:\\.|[^"\\])*"(?=\)$)/}}}}),Prism.languages.markdown.bold.inside.url=Prism.util.clone(Prism.languages.markdown.url),Prism.languages.markdown.italic.inside.url=Prism.util.clone(Prism.languages.markdown.url),Prism.languages.markdown.bold.inside.italic=Prism.util.clone(Prism.languages.markdown.italic),Prism.languages.markdown.italic.inside.bold=Prism.util.clone(Prism.languages.markdown.bold); +Prism.languages.perl={comment:[{pattern:/(^\s*)=\w+[\s\S]*?=cut.*/m,lookbehind:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0}],string:[{pattern:/\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,greedy:!0},{pattern:/\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:[^\\]|\\[\s\S])*?\1/,greedy:!0},{pattern:/\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/,greedy:!0},{pattern:/\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/,greedy:!0},{pattern:/\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/,greedy:!0},{pattern:/\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/,greedy:!0},{pattern:/("|`)(?:[^\\]|\\[\s\S])*?\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:/\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[msixpodualngc]*/,greedy:!0},{pattern:/\b(?:m|qr)\s+([a-zA-Z0-9])(?:[^\\]|\\.)*?\1[msixpodualngc]*/,greedy:!0},{pattern:/\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/,greedy:!0},{pattern:/\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/,greedy:!0},{pattern:/\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/,greedy:!0},{pattern:/\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/,greedy:!0},{pattern:/(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:[^\\]|\\[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/,lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/i,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*>|\b_\b/,alias:"symbol"},vstring:{pattern:/v\d+(\.\d+)*|\d+(\.\d+){2,}/,alias:"string"},"function":{pattern:/sub [a-z0-9_]+/i,inside:{keyword:/sub/}},keyword:/\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/,punctuation:/[{}[\];(),:]/}; +Prism.languages.python={"triple-quoted-string":{pattern:/"""[\s\S]+?"""|'''[\s\S]+?'''/,alias:"string"},comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:{pattern:/("|')(?:\\\\|\\?[^\\\r\n])*?\1/,greedy:!0},"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/}; diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/index.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/index.cgi Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,1205 @@ +#!/bin/sh +# +# SliTaz Cooker CGI + Lighttpd web interface. +# + +# Make request URI relative to the script name +base="$(dirname "$SCRIPT_NAME")"; [ "$base" == '/' ] && base='' +REQUEST_URI=$(echo "$REQUEST_URI" | sed "s|^$base/*|/|; s|\?.*||") + +# Split the URI request to /pkg/cmd/arg +export pkg=$(echo "$REQUEST_URI" | cut -d/ -f2) +export cmd=$(echo "$REQUEST_URI" | cut -d/ -f3) +export arg=$(echo "$REQUEST_URI" | sed 's|^/[^/]*/[^/]*/||') + + +. /usr/lib/slitaz/httphelper.sh + +[ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf +[ -f "./cook.conf" ] && . ./cook.conf +wok="$WOK" +title=${title:-SliTaz Cooker} +# Cooker DB files. +activity="$CACHE/activity" +commits="$CACHE/commits" +cooklist="$CACHE/cooklist" +cookorder="$CACHE/cookorder" +command="$CACHE/command"; touch $command +blocked="$CACHE/blocked" +broken="$CACHE/broken" +cooknotes="$CACHE/cooknotes" +cooktime="$CACHE/cooktime" +wokrev="$CACHE/wokrev" + +# Path to markdown to html convertor +cmark_opts='--smart -e table -e strikethrough -e autolink -e tagfilter' +if [ -n "$(which cmark 2>/dev/null)" ]; then + md2html="$(which cmark) $cmark_opts" +elif [ -x "./cmark" ]; then + md2html="./cmark $cmark_opts" +elif [ -n "$(which sundown 2>/dev/null)" ]; then + md2html=$(which sundown) +elif [ -x "./sundown" ]; then + md2html="./sundown" +fi + + + + +# Search form redirection +if [ -n "$(GET search)" ]; then + echo -e "HTTP/1.1 301 Moved Permanently\nLocation: $base/$(GET q)\n\n" + exit 0 +fi + + +# Show the running command and it's progression + +running_command() { + state="$(cat $command)" + local pct + if [ -n "$state" ];then + echo -n "$stateCompletion" + set -- $(grep "^$state" $cooktime) + [ -n "$1" -a $2 -ne 0 ] && pct=$((($(date +%s)-$3)*100/$2)) + [ -n "$pct" ] && max="max='100'" + echo -n "" + echo -n " ${pct:-?}%" + [ "$2" -gt 60 ] && + echo -n "Estimated end time$(date +%H:%M -ud @$(($2+$3)))" + else + echo 'not running' + fi +} + + +# HTML page header + +page_header() { + local theme t='' css + theme=$(COOKIE theme) + [ "$theme" == 'default' ] && theme='' + [ -n "$theme" ] && theme="-$theme" + css="cooker$theme.css" + + echo -e 'Content-Type: text/html; charset=UTF-8\n' + + cat < + + + $([ -n "$pkg" ] && echo "$pkg - ")$title + + + + + + + + + +
+
+

$title

+
+ Home + Bugs + Hg + Roadmap + Pizza + Tank + | + Cross + i486 + ISO + +
+
+ +
+EOT + + [ -n "$(GET debug)" ] && echo "
$(env | sort)
" +} + + +# HTML page footer + +page_footer() { + date_now=$(date +%s) + sec_now=$(date +%S); sec_now=${sec_now#0} # remove one leading zero + wait_sec=$(( 60 - $sec_now )) + cat < + + +
+ + + + +EOT +} + + +show_note() { + echo "
$2
" +} + + +not_found() { + local file="${1#$PKGS/}"; file="${file#$LOGS/}"; file="${file#$WOK/}" + echo "HTTP/1.1 404 Not Found" + page_header + echo "

Not Found

" + case $2 in + pkg) + show_note e "The requested package “$(basename "$(dirname "$file")")” was not found." ;; + *) + show_note e "The requested file “$file” was not found." ;; + esac + page_footer +} + + +manage_modified() { + local file="$1" option="$2" nul day mon year time hh mm ss date_s + if [ ! -f "$file" ]; then + if [ "$option" == 'silently-absent' ]; then + echo "HTTP/1.1 404 Not Found" + return + else + not_found "$file" "$2" + exit + fi + fi + [ "$option" == 'no-last-modified' ] && return + if [ -n "$HTTP_IF_MODIFIED_SINCE" ]; then + echo "$HTTP_IF_MODIFIED_SINCE" | \ + while read nul day mon year time nul; do + case $mon in + Jan) mon='01';; Feb) mon='02';; Mar) mon='03';; Apr) mon='04';; + May) mon='05';; Jun) mon='06';; Jul) mon='07';; Aug) mon='08';; + Sep) mon='09';; Oct) mon='10';; Nov) mon='11';; Dec) mon='12';; + esac + hh=$(echo $time | cut -d: -f1) + mm=$(echo $time | cut -d: -f2) + ss=$(echo $time | cut -d: -f3) + date_s=$(date -ud "$year$mon$day$hh$mm.$ss" +%s) +# if [ "$date_s" -ge "$(date -ur "$file" +%s)" ]; then +# echo -e 'HTTP/1.1 304 Not Modified\n' +# exit +# fi +# TODO: improve caching control + done + fi + echo "Last-Modified: $(date -Rur "$file" | sed 's|UTC|GMT|')" + echo "Cache-Control: public, max-age=3600" +} + + +# Query '?pct=': update percentage + +if [ -n "$(GET pct)" ]; then + pkg="$(GET pct)" + state="$(cat $command)" + if [ "$state" == "cook:$pkg" ]; then + set -- $(grep "^$state" $cooktime) + [ -n "$1" ] && pct=$(( ($(date +%s) - $3) * 100 / $2 )) + echo "${pct:-?}" + else + echo 'reload' + fi + exit 0 +fi + + +# Query '?poke': poke cooker + +if [ -n "$(GET poke)" ]; then + touch $CACHE/cooker-request + echo -e "Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}\n" + exit +fi + + +# Query '?recook=': query to recook package + +if [ -n "$(GET recook)" ]; then + pkg="$(GET recook)" + case "$HTTP_USER_AGENT" in + *SliTaz*) + grep -qs "^$pkg$" $CACHE/recook-packages || + echo "$pkg" >> $CACHE/recook-packages + esac + echo -e "Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}\n" + exit +fi + + +# Query '/i//': show indicator icon +# Can't use ?query - not able to change '+' to '%2B' in the sed rules (see log handler) + +if [ "$pkg" == 'i' ]; then + echo -en "Content-Type: image/svg+xml\n\n" + else + echo "m0 3v8l1 1h6l1-1v-8l-1-1h-6zm3 0h2v5h-2zm0 6h2v2h-2z' fill='#d00'/>" + fi + exit +fi + + +# Query '?theme[=]': change UI theme + +if [ -n "$(GET theme)" ]; then + theme="$(GET theme)" + case $theme in + theme) + current=$(COOKIE theme) + page_header + cat < +

Change theme

+

Current theme: “${current:-default}”. Select other:

+
    + $( + for i in default emerald sky goldenrod like2016 terminal; do + [ "$i" == "${current:-default}" ] || echo "
  • $i
  • " + done + ) +
+ +EOT + page_footer + exit 0 + ;; + default|emerald|sky|goldenrod|like2016|terminal) + # Expires in a year + expires=$(date -uRd @$(($(date +%s)+31536000)) | sed 's|UTC|GMT|') + echo -e "HTTP/1.1 302 Found\nLocation: $base/\nCache-Control: no-cache\nSet-Cookie: theme=$theme; expires=$expires\n\n" + exit 0 + ;; + esac +fi + + +#case "$QUERY_STRING" in +# stuff*) +# file="$wok/$(GET stuff)" +# manage_modified "$file" +# ;; +# +# pkg=*|receipt=*|description=*|files=*|log=*|man=*|doc=*|info=*) +# type=${QUERY_STRING%%=*} +# pkg=$(GET $type) +# case "$type" in +# description) +# manage_modified "$wok/$pkg/receipt" 'no-last-modified' +# manage_modified "$wok/$pkg/description.txt" 'silently-absent' +# ;; +# log) +# manage_modified "$wok/${pkg%%.log*}/receipt" 'no-last-modified' +# manage_modified "$LOGS/$pkg" +# ;; +# *) +# manage_modified "$wok/$pkg/receipt" pkg +# ;; +# esac +# ;; +#esac + + +# RSS feed generator +# URI: ?rss[&limit={1..100}] + +if [ -n "$(GET rss)" ]; then + limit=$(GET limit); limit="${limit:-12}"; [ "$limit" -gt 100 ] && limit='100' + pubdate=$(date -Rur$(ls -t $FEEDS/*.xml | head -n1) | sed 's|UTC|GMT|') + cooker_url="http://$HTTP_HOST$base/" + cat < + + + $title + The SliTaz packages cooker feed + $cooker_url + $pubdate + $pubdate + +EOT + for rss in $(ls -t $FEEDS/*.xml | head -n$limit); do + sed "s|http[^=]*=|$cooker_url|; s| + +EOT + exit 0 +fi + + + + +# +# Functions +# + + +# Unpack to stdout + +docat() { + case "$1" in + *gz) zcat ;; + *bz2) bzcat ;; + *xz) xzcat ;; + *) cat + esac < $1 +} + + +# Tiny texinfo converter + +info2html() { + sed \ + -e 's|&|\&|g; s|<|\<|g; s|>|\>|g' \ + -e 's|^\* \(.*\)::|* \1 |' \ + -e 's|\*note \(.*\)::|\1|' \ + -e '/^File: / s|(dir)|Top|g' \ + -e '/^File: / s|Next: \([^,]*\)|Next: \1|' \ + -e '/^File: / s|Prev: \([^,]*\)|Prev: \1|' \ + -e '/^File: / s|Up: \([^,]*\)|Up: \1|' \ + -e '/^File: / s|^.* Node: \([^,]*\), *\(.*\)$|
\2|' \
+		-e '/^
]*>\)\(]*>Next: [^,]*\), *\(]*>Prev: [^,]*\), *\(]*>Up: .*\)|\1 \3 \4 \2|' \
+		-e '/^Tag Table:$/,/^End Tag Table$/d' \
+		-e '/INFO-DIR/,/^END-INFO-DIR/d' \
+		-e "s|https*://[^>),'\"\`’ ]*|&|g" \
+		-e "s|ftp://[^>),\"\` ]*|&|g" \
+		-e 's|^\* Menu:|Menu:|' \
+		-e "s|^|
|" +} + + +# Put some colors into log and DB files. + +syntax_highlighter() { + case $1 in + log) + # If variables not defined - define them with some rare values + : ${_src=#_#_#} + : ${_install=#_#_#} + : ${_fs=#_#_#} + : ${_stuff=#_#_#} + # Use one-letter html tags to save some bytes :) + # is error (red) is warning (orange) is informal (green) + sed -e 's/&/\&/g; s//\>/g' \ + -e 's#OK$#OK#' \ + -e 's#\([Dd]one\)$#\1#' \ + -e 's#Success$#Success#' \ + -e 's#\([^a-z]\)ok$#\1ok#' \ + -e 's#\([^a-z]\)yes$#\1yes#' \ + -e 's#\([^a-z]\)no$#\1no#' \ + -e 's#\([^a-z]\)none$#\1none#' \ + -e 's#\([^a-z]\)false$#\1false#' \ + -e 's#\(^checking .*\.\.\. \)\(.*\)$#\1\2#' \ + \ + -e 's#\( \[Y[nm/]\?\] n\)$# \1#' \ + -e 's#\( \[N[ym/]\?\] y\)$# \1#' \ + -e 's# y$# y#' \ + -e 's# n$# n#' \ + -e 's#(NEW) *$#(NEW)#' \ + \ + -e 's#.*(pkg/local).*#\0#' \ + -e 's#.*(web/cache).*#\0#' \ + \ + -e 's#\([^a-zA-Z]\)\([Ee]rror\)$#\1\2#' \ + -e 's#ERROR:#ERROR:#g' \ + \ + -e 's#^.*[Ff]ailed.*#\0#' \ + -e 's#^.*[Ff]atal.*#\0#' \ + -e 's#^.*[Nn]ot found.*#\0#' \ + -e 's#^.*[Nn]o such file.*#\0#' \ + -e 's#^.*No package .* found.*#\0#' \ + -e 's#^.*Unable to find.*#\0#' \ + -e 's#^.*[Ii]nvalid.*#\0#' \ + -e 's#\([Nn][Oo][Tt] found\)$#\1#' \ + -e 's#\(found\)$#\1#' \ + \ + -e 's#^.*WARNING:.*#\0#' \ + -e 's#^.*warning:.*#\0#' \ + -e 's#^.* [Ee]rror:* .*#\0#' \ + -e 's#^.*terminated.*#\0#' \ + -e 's#\(missing\)#\1#g' \ + -e 's#^.*[Cc]annot find.*#\0#' \ + -e 's#^.*unrecognized options.*#\0#' \ + -e 's#^.*does not.*#\0#' \ + -e 's#^.*[Ii]gnoring.*#\0#' \ + -e 's#^.*note:.*#\0#' \ + \ + -e 's#^.* will not .*#\0#' \ + -e 's!^Hunk .* succeeded at .*!\0!' \ + -e 's#^.* Warning: .*#\0#' \ + \ + -e "s#^Executing:\([^']*\).#\0#" \ + -e "s#^Making.*#\0#" \ + -e "s#^Scanning dependencies of target .*#\0#" \ + -e "s#^====\([^']*\).#\0#g" \ + -e "s#^[a-zA-Z0-9]\([^']*\) :: #\0#g" \ + -e "s#[fh]tt*ps*://[^ '\"]*#\0#g" \ + \ + -e "s|$_src|\${src}|g; + s|$_install|\${install}|g; + s|$_fs|\${fs}|g; + s|$_stuff|\${stuff}|g" \ + -e "s|\[9\([1-6]\)m||; + s|\[39m||;" + ;; + + files) + # Highlight the Busybox's `ls` output + awk '{ + part1 = substr($0, 0, 16); + part2 = substr($0, 17, 9); + part3 = substr($0, 26, 9); + part4 = substr($0, 35); + if (part2 != "root ") part2 = "" part2 ""; + if (part3 != "root ") part3 = "" part3 ""; + print part1 part2 part3 part4; + }' | \ + sed "s|\[\([01]\);3\([1-7]\)m||g; + s|\[\([01]\);0m||g; + s|\[0m||g; + s|^\(lrwxrwxrwx\)|\1|; + s|^\(-rwxr-xr-x\)|\1|; + s|^\(-rw-r--r--\)|\1|; + s|^\([lrwx-]*\)|\1|; + " + ;; + esac +} + + +show_code() { + echo -n "
"
+	sed 's|&|\&|g; s|<|\<|g; s|>|\>|g'
+	echo '
' +} + + +datalist() { + ( + cd $wok + + ls | awk ' + BEGIN{printf("")} + {printf("",$1)} + END {printf("")} + ' + ) +} + + +mklog() { + awk ' + BEGIN { printf("
\n") }
+		  { print }
+	  END { print "
" }' +} + + +summary() { + log="$1" + pkg="$(basename ${log%%.log*})" + + if [ -f "$log" ]; then + if grep -q "cook:$pkg$" $command; then + show_note i "The Cooker is currently building $pkg" + elif fgrep -q "Summary for:" $log; then + sed '/^Summary for:/,$!d' $log | head -n13 | awk ' + BEGIN { print "
" } + { + if (NR==1) { + printf("

%s

\n\n", $0) + } else if ($0 !~ "===") { + split($0, s, " : "); + printf("", s[1], s[2]); + } + } + END { print "
%s%s
" } + ' + elif fgrep -q "Debug information" $log; then + echo -e '
\n

Debug information

' + sed -e '/^Debug information/,$!d; /^===/d; /^$/d' $log | sed -n '1!p' | \ + if [ -n "$2" ]; then + syntax_highlighter log | sed 's|\([0-9][0-9]*\):|\1:|' + else + sed 's|^[0-9][0-9]*:||' | syntax_highlighter log + fi | mklog + echo '
' + fi + else + [ -n "$pkg" -a -d "$wok/$pkg" ] && show_note e "No log for $pkg" + fi +} + + +active() { + [ "$cmd" == "$1" -o "$cmd" == "${2:-$1}" ] && echo -n ' active' +} + + +pkg_info() { + local log active bpkg + log="$LOGS/$pkg.log" + + echo "

Package “$pkg”

" + echo '
' + echo "receipt & stuff" + + unset WEB_SITE WANTED + . $wok/$pkg/receipt + + [ -n "$WEB_SITE" ] && + echo "web site" + + if [ -f "$wok/$pkg/taz/$PACKAGE-$VERSION/receipt" ]; then + echo "files" + + [ -f "$wok/$pkg/description.txt" ] && + echo "description" + + unset EXTRAVERSION + . $wok/$pkg/taz/$PACKAGE-$VERSION/receipt + for filename in "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg"; do + [ -f "$PKGS/$filename" ] && + echo "download" + done + + fi + + [ -n "$TARBALL" -a -s "$SRC/$TARBALL" ] && + echo "source" + + echo "browse" + + [ -x ./man2html -a -d "$wok/$pkg/install/usr/share/man" ] && + echo "man" + + [ -d "$wok/$pkg/install/usr/share/doc" -o -d "$wok/$pkg/install/usr/share/gtk-doc" ] && + echo "doc" + + [ -d "$wok/$pkg/install/usr/share/info" ] && + echo "info" + + [ -s "$log" ] && + echo "logs" + + echo '
' +} + + +mktable() { + sed 's# : #|#' | awk -vc="$1" ' + BEGIN { printf("\n", c); FS="|" } + { printf("", $1); + if (NF == 2) printf("", $2); + printf("\n", $2) } + END { print "
%s%s
" }' +} + + +section() { + local i=$(basename "$1") + echo -e '\n\n
' + [ $(wc -l < $1) -gt $2 ] && echo "${3#*|}" + echo "

${3%|*}

" + mktable "$i" + echo '
' +} + + + + +# +# Load requested page +# + +if [ -z "$pkg" ]; then + + page_header + if [ -n "$QUERY_STRING" -a "$QUERY_STRING" != 'debug' ]; then + + for list in activity cooknotes cooklist; do + [ -n "$(GET $list)" ] || continue + [ "$list" == 'cooklist' ] && nb="- Packages: $(wc -l < $cooklist)" + echo '
' + echo "

DB: $list $nb

" + tac $CACHE/$list | sed 's|cooker.cgi?pkg=||; + s|\[ Done|Done|; + s|\[ Failed|Failed|; + s| \]||' | mktable $list + echo '
' + done + + if [ -n "$(GET broken)" ]; then + echo '
' + echo "

DB: broken - Packages: $(wc -l < $broken)

" + sort $CACHE/broken | sed "s|^[^']*|\0|g" | mktable + echo '
' + fi + + case "$QUERY_STRING" in + *.log) + log=$LOGS/$QUERY_STRING + name=$(basename $log) + if [ -f "$log" ]; then + echo "

Log for: ${name%.log}

" + if fgrep -q "Summary" $log; then + echo '
'
+						grep -A 20 '^Summary' $log | syntax_highlighter log
+						echo '
' + fi + echo '
'
+					syntax_highlighter log < $log
+					echo '
' + else + show_note e "No log file: $log" + fi + ;; + esac + page_footer + exit 0 + fi + + + # We may have a toolchain.cgi script for cross cooker's + if [ -f "toolchain.cgi" ]; then + toolchain="toolchain.cgi" + else + toolchain="slitaz-toolchain/" + fi + # Main page with summary. Count only package include in ARCH, + # use 'cooker arch-db' to manually create arch.$ARCH files. + inwok=$(ls $WOK/*/arch.$ARCH | wc -l) + cooked=$(ls $PKGS/*.tazpkg | wc -l) + unbuilt=$(($inwok - $cooked)) + pct=0; [ $inwok -gt 0 ] && pct=$(( ($cooked * 100) / $inwok )) + cat < + +
+ + +

Summary

+EOT + +mktable <$(cat $wokrev) +Commits to cook : $(wc -l < $commits) +Current cooklist : $(wc -l < $cooklist) +Broken packages : $(wc -l < $broken) +Blocked packages : $(wc -l < $blocked) +Architecture : $ARCH, toolchain +Server date : $(date -u '+%F %R %Z') +EOT + + # If command is "cook:*", update gauge and percentage periodically. + # If different package is cooking, reload the page (with new settings) + cmd="$(cat $command)" + case "$cmd" in + cook:*) + pkg=${cmd#*:} + echo "" + ;; + esac + + if [ -e "$CACHE/cooker-request" -a ! -s $command ]; then + if [ "$activity" -nt "$CACHE/cooker-request" ]; then + echo 'Wake up' + else + show_note i 'Cooker will be launched in the next 5 minutes.' + fi + fi + + cat <Packages: $inwok in the wok · $cooked cooked · $unbuilt unbuilt

+ +
${pct}%${pct}%
+ +

+ Service logs: + cookorder · + commits · + pkgdb +

+
+EOT + + tac $activity | head -n12 | sed 's|cooker.cgi?pkg=||; + s|\[ Done|Done|; + s|\[ Failed|Failed|; + s| \]||; + s|%2B|\+|g' | \ + section $activity 12 "Activity|More activity" + + [ -s "$cooknotes" ] && tac $cooknotes | head -n12 | \ + section $cooknotes 12 "Cooknotes|More notes" + + [ -s "$commits" ] && + section $commits 20 "Commits|More commits" < $commits + + [ -s "$cooklist" ] && head -n 20 $cooklist | \ + section $cooklist 20 "Cooklist|Full cooklist" + + [ -s "$broken" ] && head -n20 $broken | sed "s|^[^']*|\0|g" | \ + section $broken 20 "Broken|All broken packages" + + [ -s "$blocked" ] && sed "s|^[^']*|\0|g" $blocked | \ + section $blocked 12 "Blocked|All blocked packages" + + cd $PKGS + ls -let *.tazpkg | awk ' + (NR<=20){ + sub(/:[0-9][0-9]$/, "", $9); + mon = index(" JanFebMarAprMayJunJulAugSepOctNovDec", $7) / 3; + printf("%d-%02d-%02d %s : %s\n", $10, mon, $8, $9, $11, $11); + }' | \ + section $activity 1000 "Latest cook" + + echo '' + datalist + page_footer + exit 0 +fi + + +case "$cmd" in + '') + page_header + log=$LOGS/$pkg.log + + # Package info. + if [ -f "$wok/$pkg/receipt" ]; then + pkg_info + else + if [ $(ls $wok/*$pkg*/receipt 2>/dev/null | wc -l) -eq 0 ]; then + echo "

Not Found

" + show_note e "The requested package $pkg was not found on this server." + else + # Search page + echo "

Package names matching “$pkg”

" + echo "" + for i in $(cd $wok; ls *$pkg*/receipt); do + pkg=$(dirname $i) + unset SHORT_DESC CATEGORY + . $wok/$pkg/receipt + echo -n "" + echo -n "" + done + echo '
NameDescriptionCategory
$pkg$SHORT_DESC$CATEGORY
' + unset pkg + fi + page_footer + exit 0 + fi + + # Check for a log file and display summary if it exists. + summary "$log" + + # Display button only for SliTaz web browser + if [ -f "$log" ]; then + case "$HTTP_USER_AGENT" in + *SliTaz*) + if [ -f $CACHE/cooker-request -a -n "$HTTP_REFERER" ]; then + if grep -qs "^$pkg$" $CACHE/recook-packages; then + show_note i "The package “$pkg” has been requested for recook" + else + echo "Recook $pkg" + fi + fi + ;; + esac + fi + ;; + + receipt) + page_header + pkg_info + echo "receipt" + ( cd $wok/$pkg; find stuff -type f 2>/dev/null ) | sort | \ + awk -vb="$base/$pkg" '{printf("%s\n", b, $0, $0)}' + + show_code bash < $wok/$pkg/receipt + ;; + + stuff) + page_header + pkg_info + file="$pkg/stuff/$arg" + echo "receipt" + ( cd $wok/$pkg; find stuff -type f 2>/dev/null ) | sort | \ + awk -vb="$base/$pkg" -va="stuff/$arg" '{ + printf("%s\n", a==$0 ? " receipt" : "", b, $0, $0) + }' + + if [ -f "$wok/$file" ]; then + case $file in + *.desktop|*.theme) class="ini" ;; + *.patch|*.diff|*.u) class="diff" ;; + *.sh) class="bash" ;; + *.conf*|*.ini) + class="bash" + [ -n "$(cut -c1 < $wok/$file | fgrep '[')" ] && class="ini" + ;; + *.pl) class="perl" ;; + *.c|*.h|*.awk) class="clike" ;; + *.svg) class="svg" ;; + *Makefile*) class="makefile" ;; + *.po|*.pot) class="bash" ;; + *.css) class="css" ;; + *.htm|*.html) class="html" ;; + *.js) class="js" ;; + *.txt) class="asciidoc" ;; + *) + case $(head -n1 $wok/$file) in + *!/bin/sh*|*!/bin/bash*) class="bash" ;; + esac + if [ -z "$class" -a "$(head -n1 $wok/$file | cut -b1)" == '#' ]; then + class="bash" + fi + if [ -z "$class" ]; then + # Follow Busybox restrictions. Search for non-printable chars + if [ $(tr -d '[:alnum:][:punct:][:blank:][:cntrl:]' < "$wok/$file" | wc -c) -gt 0 ]; then + raw="true" + fi + fi + ;; + esac + + # Display image + case $file in + *.png|*.svg|*.jpg|*.jpeg|*.ico) + echo "" + ;; + esac + + # Display colored listing for all text-based documents (also for *.svg) + case $file in + *.png|*.jpg|*.jpeg|*.ico) ;; + *) + if [ -z "$raw" ]; then + cat $wok/$file | show_code $class + fi + ;; + esac + + # Display hex dump for binary files + if [ -n "$raw" ]; then + hexdump -C $wok/$file | show_code #| sed 's|^\([0-9a-f][0-9a-f]*\)|\1|' + fi + else + show_note e "File “$file” absent!" + fi + ;; + + files) + page_header + pkg_info + + packaged=$(mktemp) + + # find main package + wanted=$(. $wok/$pkg/receipt; echo $WANTED) + main=${wanted:-$pkg} + # identify splitted packages + split="$main $(. $wok/$main/receipt; echo $SPLIT)" + [ -d "$wok/$main-dev" ] && split="$split $main-dev" + split="$(echo $split | tr ' ' '\n' | sort -u)" + # finally we need the version + ver=$(. $wok/$main/receipt; echo $VERSION$EXTRAVERSION) + + for p in $split; do + namever="$p-$ver" + if [ -d "$wok/$p/taz/$p-$ver" ]; then + indir=$p + elif [ -d "$wok/$main/taz/$p-$ver" ]; then + indir=$main + fi + dir="$wok/$indir/taz/$p-$ver/fs" + + size=$(du -hs $dir | awk '{ sub(/\.0/, ""); print $1 }') + + echo "

Files of package “$namever” ($size):

" + echo -en '
\npermissions·lnk·user    ·'
+			echo -en 'group   ·     size·date & time ·file name\n'
+			find $dir -not -type d -print0 | sort -z | xargs -0 ls -ld --color=always | \
+			syntax_highlighter files | \
+			sed "s|\([^>]*\)>/.*/fs\([^<]*\)\(<.*\)$|\1 href='$base/$indir/browse/taz/$p-$ver/fs\2'>\2\3|" | \
+			awk 'BEGIN { FS="\""; }
+				{ gsub("+", "%2B", $2); print; }'
+			echo '
' + cat $wok/$indir/taz/$p-$ver/files.list >> $packaged + done + + # find repeatedly packaged files + repeats="$(sort $packaged | uniq -d)" + if [ -n "$repeats" ]; then + echo -n '

Repeatedly packaged files:

'
+			echo "$repeats" | sed 's|^|!!! |'
+			echo "
" + fi + + # find unpackaged files + all_files=$(mktemp) + cd $wok/$main/install; find ! -type d | sed 's|\.||' > $all_files + orphans="$(sort $all_files $packaged | uniq -u)" + if [ -n "$orphans" ]; then + echo -n '

Unpackaged files:

'
+			echo "$orphans" | awk '
+			function tag(text, color) { printf("%s %s\n", color, text, $0); }
+			/\/perllocal.pod$/ || /\/\.packlist$/ || /\/share\/bash-completion\// { tag("---", 0); next }
+			/\.pod$/  { tag("pod", 5); next }
+			/\/share\/man\// { tag("man", 5); next }
+			/\/share\/doc\// || /\/share\/gtk-doc\// || /\/share\/info\// || /\/share\/devhelp\// { tag("doc", 5); next }
+			/\/share\/icons\// { tag("ico", 2); next }
+			/\/share\/locale\// { tag("loc", 4); next }
+			/\.h$/ || /\.a$/ || /\.la$/ || /\.pc$/ || /\/bin\/.*-config$/ { tag("dev", 3); next }
+			{ tag("???", 1) }
+			'
+			echo '
' + fi + ;; + + description) + page_header + pkg_info + desc="$WOK$REQUEST_URI.txt" + if [ -s "$desc" ]; then + echo '
' + if [ -n "$md2html" ]; then + $md2html $desc + else + show_code markdown < $desc + fi + echo '
' + else + show_note w "No description of $pkg" + fi + ;; + + log) + page_header + pkg_info + [ -z "$arg" ] && arg=$(stat -c %Y $LOGS/$pkg.log) + + echo '
' + acc='l' + while read log; do + timestamp=$(stat -c %Y $log) + class='' + if [ "$arg" == "$timestamp" ]; then + class=' log' + logfile="$log" + fi + echo -n "" + echo "$(stat -c %y $log | cut -d: -f1,2)" + case $acc in + l) acc=0;; + *) acc=$((acc+1));; + esac + done <' + + if [ -z "$logfile" ]; then + show_note e "Requested log is absent" + page_footer + exit 0 + fi + + # Define cook variables for syntax highlighter + if [ -s "$WOK/$pkg/receipt" ]; then + . "$WOK/$pkg/receipt" + _wok='/home/slitaz/wok' + _src="$_wok/$pkg/source/$PACKAGE-$VERSION" + _install="$_wok/$pkg/install" + _fs="$_wok/$pkg/taz/$PACKAGE-$VERSION/fs" + _stuff="$_wok/$pkg/stuff" + fi + +# if [ ! -f "gzlog/$pkg.$arg" ]; then +# { +# summary "$logfile" links +# +# syntax_highlighter log < $logfile | awk ' +# BEGIN { print "
"; }
+#				      { printf("%5d  %s\n", NR, NR, NR, $0); }
+#				END   { print "
"; } +# ' +# +# page_footer +# } | gzip > gzlog/$pkg.$arg +# fi + + blog=$(basename $logfile) + summary "$logfile" links + + # disable next `sed` for the 'like2016' theme + theme=$(COOKIE theme); theme=${theme:-default}; [ "$theme" != 'like2016' ] && theme='' + cat $logfile | syntax_highlighter log | \ + sed -e "/(pkg\/local$theme):/ s|: \([^<]*\)| \1|" | \ + awk ' + BEGIN { print "
"; }
+		      { printf("%5d  %s\n", NR, NR, NR, $0); }
+		END   { print "
"; } + ' + ;; + + + man|doc|info) + page_header + pkg_info + echo '
' + + dir="wok/$pkg/install/usr/share/$cmd" + [ "$cmd" == 'doc' ] && dir="$dir wok/$pkg/install/usr/share/gtk-doc" + if [ "$cmd" == 'doc' -a -z "$arg" ]; then + try=$(for i in $dir; do find $i -name 'index.htm*'; done | sed q) + [ -n "$try" ] && arg="$try" + fi + while read i; do + [ -s "$i" ] || continue + case "$i" in + *.jp*g|*.png|*.gif|*.svg|*.css) continue + esac + i=${i#$dir/} + [ -n "$arg" ] || arg="$i" + class=''; [ "$arg" == "$i" ] && class=" doc" + case "$cmd" in + man) + case $i in + man*) lang='';; + *) lang="${i%%/*}: ";; + esac + man=$(basename $i .gz) + echo "$lang${man%.*} (${man##*.})" + ;; + doc) + echo "$(basename $i .gz)" + ;; + info) + info=$(basename $i) + echo "${info/.info/}" + ;; + esac + done <' + + [ -f "$arg" ] || arg="$dir/$arg" + if [ -f "$arg" ]; then + tmp="$(mktemp)" + docat "$arg" > $tmp + [ -s "$tmp" ] && + case "$cmd" in + info) + echo '
'
+					info2html < "$tmp"
+					echo '
' + ;; + doc) + case "$arg" in + *.sgml|*.devhelp2) class='xml';; + *.py) class='python';; # pycurl package + *.css) class='css';; + *) class='asciidoc';; + esac + case "$arg" in + *.htm*) + case $arg in + wok/*) page="${arg#wok/}"; page="$base/$pkg/browse/${page#*/}";; + *) page="$base/$pkg/browse/install/usr/share/$cmd/$arg";; + esac + # make the iframe height so long to contain it's content without scrollbar + echo "" + ;; + *.pdf) + case $arg in + wok/*) page="${arg#wok/}"; page="$base/$pkg/browse/${page#*/}";; + *) page="$base/$pkg/browse/install/usr/share/$cmd/$arg";; + esac + cat < + $(show_note w "Missing PDF plugin.
Get the file $(basename "$page").") + +EOT + ;; + *) + show_code $class < "$tmp" + ;; + esac + ;; + man) + #export TEXTDOMAIN='man2html' + echo "
" + + html=$(./man2html "$tmp" | sed -e '1,/
/d' -e '/
/,$d' \ + -e 's|]*>\([^<]*\)|\1|g') + + if [ -n "$(echo "$html" | fgrep 'The requested file /tmp/tmp.')" ]; then + # Process the pre-formatted man-cat page + echo '
'
+						sed '
+							s|M-bM-^@M-^S|—|g;
+							s|M-bM-^@M-^\\||g;
+							s|M-bM-^@M-^]||g
+							s|M-bM-^@M-^X||g;
+							s|M-bM-^@M-^Y||g;
+							s|M-BM-||g;
+							' "$tmp"
+						echo '
' + else + echo "$html" + fi + echo "
" + ;; + esac + rm -f $tmp + else + show_note e "File “$arg” not exists!" + fi + ;; + +esac + + +page_footer +exit 0 diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/lighttpd/lighttpd.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/lighttpd/lighttpd.conf Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,243 @@ +# /etc/lighttpd/lighttpd.conf: SliTaz LightTPD +# Web server configuration file. +# Configuration du serveur web. +# +# Documentation : /usr/share/doc/slitaz/handbook/web-server.html +# http://trac.lighttpd.net/trac/wiki#Documentation +# +# + +# Root documents. +# +server.document-root = "/var/www/" + +# Port, default for HTTP traffic is 80. +# +server.port = 80 + +# Server, user and group name. +# +server.username = "www" +server.groupname = "www" + +# Server header. +# Be nice and keep it at lighttpd and SliTaz GNU/Linux. +# +server.tag = "lighttpd (SliTaz GNU/Linux)" + +# Directory listings. +# +dir-listing.activate = "enable" +dir-listing.encoding = "utf-8" + +# File to open by default. +# +index-file.names = ( "index.html", "index.php", "index.cgi", "index.sh" ) + +# Log messages. +# +accesslog.filename = "/var/log/lighttpd/access.log" +server.errorlog = "/var/log/lighttpd/error.log" + +# Server pid file +server.pid-file = "/var/run/lighttpd.pid" + +# MIME type. +# +mimetype.assign = ( + # Consult /usr/share/mime/packages/freedesktop.org.xml for MIME Types. + # text + ".html" => "text/html; charset=UTF-8", + ".htm" => "text/html; charset=UTF-8", + ".xhtml" => "application/xhtml+xml; charset=UTF-8", + ".txt" => "text/plain; charset=UTF-8", + ".list" => "text/plain; charset=UTF-8", + ".conf" => "text/plain; charset=UTF-8", + ".cooklist" => "text/plain; charset=UTF-8", + "README" => "text/x-readme; charset=UTF-8", + "AUTHORS" => "text/x-authors; charset=UTF-8", + "COPYING" => "text/x-copying; charset=UTF-8", + "CREDITS" => "text/x-credits; charset=UTF-8", + "INSTALL" => "text/x-install; charset=UTF-8", + "ChangeLog" => "text/x-changelog; charset=UTF-8", + "receipt" => "text/plain; charset=UTF-8", + ".log" => "text/x-log; charset=UTF-8", + ".diff" => "text/x-patch; charset=UTF-8", + ".patch" => "text/x-patch; charset=UTF-8", + ".css" => "text/css; charset=UTF-8", + ".js" => "application/javascript; charset=UTF-8", + ".xml" => "application/xml; charset=UTF-8", + ".desktop" => "application/x-desktop; charset=UTF-8", + ".m4" => "application/x-m4; charset=UTF-8", + "Makefile" => "text/x-makefile", + ".md" => "text/markdown", + # images + ".jpg" => "image/jpeg", + ".jpeg" => "image/jpeg", + ".png" => "image/png", + ".gif" => "image/gif", + ".xbm" => "image/x-xbitmap", + ".xpm" => "image/x-xpixmap", + ".pnm" => "image/x-portable-anymap", + ".pbm" => "image/x-portable-bitmap", + ".pgm" => "image/x-portable-graymap", + ".ppm" => "image/x-portable-pixmap", + ".ico" => "image/vnd.microsoft.icon", + ".svg" => "image/svg+xml", + ".svgz" => "image/svg+xml-compressed", + ".bmp" => "image/bmp", + ".wbmp" => "image/vnd.wap.wbmp", + ".tif" => "image/tiff", + ".tiff" => "image/tiff", + # documents + ".pdf" => "application/pdf", + ".ps" => "application/postscript", + ".epub" => "application/epub+zip", + # archives / packages + ".cpio.gz" => "application/x-cpio-compressed", + ".cpio" => "application/x-cpio", + ".tar.gz" => "application/x-compressed-tar", + ".gz" => "application/gzip", + ".tar.bz2" => "application/x-bzip-compressed-tar", + ".bz2" => "application/x-bzip", + ".tar.xz" => "application/x-xz-compressed-tar", + ".xz" => "application/x-xz", + ".tar.lzma" => "application/x-lzma-compressed-tar", + ".lzma" => "application/x-lzma", + ".tar.Z" => "application/x-tarz", + ".Z" => "application/x-compress", + ".tar" => "application/x-tar", + ".zip" => "application/zip", + ".cab" => "application/vnd.ms-cab-compressed", + ".7z" => "application/x-7z-compressed", + ".a" => "application/x-archive", + ".arj" => "application/x-arj", + ".bcpio" => "application/x-bcpio", + ".rar" => "application/x-rar", + + ".tazpkg" => "application/x-tazpkg", + # multimedia + ".ogg" => "audio/ogg", + # scripts / programming languages + ".sh" => "application/x-shellscript", + ".cgi" => "application/x-shellscript", + ".csh" => "application/x-csh", + ".awk" => "application/x-awk", + ".pl" => "application/x-perl", + ".pod" => "application/x-perl", + ".php" => "application/x-php", + ".py" => "text/x-python", + ".pyc" => "application/x-python-bytecode", + ".pyo" => "application/x-python-bytecode", + ".rb" => "application/x-ruby", + ".rs" => "text/rust", + ".hh" => "text/x-c++hdr", + ".cpp" => "text/x-c++src", + ".h" => "text/x-chdr", + ".c" => "text/x-csrc", + ".cmake" => "text/x-cmake", + ".vala" => "text/x-vala", + ".vapi" => "text/x-vala", + ".p" => "text/x-pascal", + ".pas" => "text/x-pascal", + ".lua" => "text/x-lua", + # other + ".torrent" => "application/x-bittorrent", + ".iso" => "application/x-cd-image", + ".otf" => "application/x-font-otf", + ".ttf" => "application/x-font-ttf", + ".ttc" => "application/x-font-ttf", + ".gmo" => "application/x-gettext-translation", + ".mo" => "application/x-gettext-translation", + ".po" => "text/x-gettext-translation", + ".pot" => "text/x-gettext-translation-template", + ".ts" => "text/vnd.trolltech.linguist", + ".exe" => "application/x-ms-dos-executable", + ".o" => "application/x-object", + ".la" => "application/x-shared-library-la", + ".so" => "application/x-sharedlib", +) + +# Deny access the file-extensions. +# +url.access-deny = ( "~", ".inc" ) + +# Modules to load. +# See /usr/lib/lighttpd for all available modules. +# +server.modules = ( + "mod_access", + "mod_accesslog", + "mod_alias", + "mod_cgi", + "mod_rewrite", + "mod_status", + "mod_userdir", + "mod_compress" +) + +# User directory module. +# +userdir.path = "Public" +userdir.exclude-user = ("root") + +# Status module. +# +status.status-url = "/server-status" + +# Compress module +# +compress.allowed-encodings = ("gzip", "deflate") +compress.cache-dir = "/var/cache/lighttpd/compress/" +compress.filetype = ("text/plain", "text/html", "application/javascript", "text/css", "text/html") + +## CGI module. You can install Perl and assign .pl and .cgi script +# to /usr/bin/perl. +# +$HTTP["url"] =~ "/cgi-bin/" { + cgi.assign = ( + ".sh" => "/bin/sh", + ".cgi" => "/bin/sh" + ) +} + +# Fast CGI modules for PHP. +# +#fastcgi.server = ( ".php" => (( + #"bin-path" => "/usr/bin/php-cgi", + #"socket" => "/tmp/php.socket" + #))) + +# Alias URLs for localhost (doc, examples and PHP info). +# +$HTTP["remoteip"] =~ "127.0.0.1" { + alias.url += ( + "/doc/" => "/usr/share/doc/", + "/examples/" => "/usr/share/examples/", + "/phpinfo/" => "/usr/share/phpinfo/" + ) +} + +## Virtual hosts. +# +# If you want name-based virtual hosting load mod_simple_vhost. +# +# You can directly put vhost in this file or use a sepate one for all +# virtual hosting. +# +include "vhosts.conf" + +# Example.org +# +#$HTTP["host"] =~ "(^|\.)example\.org$" { + #server.document-root = "/var/www/vhost/exemple.com/html" + #server.errorlog = "/var/log/lighttpd/example.org-error.log" + #accesslog.filename = "/var/log/lighttpd/example.org-access.log" +#} + +# Deny access for all image stealers (anti-hotlinking for images) +# +#$HTTP["referer"] !~ "^($|http://www\.example\.org)" { +# url.access-deny = ( ".jpg", ".jpeg", ".png" ) +#} + diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/lighttpd/vhosts.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/lighttpd/vhosts.conf Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,44 @@ +# /etc/lighttpd/vhosts.conf : Virtual hosts configuration file. +# + +# cook.slitaz.org +# +$HTTP["host"] =~ "cook\.slitaz\.org$" { + server.document-root = "/home/slitaz/www/cook" + server.errorlog = "/var/log/lighttpd/cook.slitaz.org-error.log" + accesslog.filename = "/var/log/lighttpd/cook.slitaz.org-access.log" + cgi.assign = ( ".cgi" => "/bin/sh" ) + index-file.names = ( "index.cgi" ) + + url.rewrite-once = ( + # ./wok -> symlink to wok folder + "^/next/([^/]+)/browse(.+)" => "/next/wok/$1/$2", + "^/([^/]+)/browse(.+)" => "/wok/$1/$2", + # ./packages -> symlink to packages folder + "^/next/get/(.+)" => "/next/packages/$1", + "^/get/(.+)" => "/packages/$1", + # ./src -> symlink to sources folder + "^/next/src/(.+)" => "/next/src/$1", + "^/src/(.+)" => "/src/$1" + ) + + url.rewrite-if-not-file = ( + "^/next/[^\?]*\?(.+)" => "/next/index.cgi?$1", + "^/next/.*" => "/next/index.cgi", + "^/[^\?]*\?(.+)" => "/index.cgi?$1", + "^/.*" => "/index.cgi" + ) + +# First enable compressing globally in lighttpd.conf: server.modules = ( ... "mod_compress" ... ) +# Also use global settings or change them here: +# compress.allowed-encodings = ("gzip", "deflate") +# compress.cache-dir = "/var/www/cache/" +# compress.filetype = ("text/plain", "text/html") + +# External js supported only since lighttpd 1.4.42, try to inject js here :-D +# dir-listing.external-css = "/cooker.css" +# dir-listing.external-js = "/listing.js" + dir-listing.external-css = "/cooker.css\" /> +} diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/listing.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lighttpd/listing.js Thu May 11 00:17:06 2017 +0300 @@ -0,0 +1,7 @@ +// Click on header return us to the package page +function setLink() { + document.getElementsByTagName("h2")[0].onclick = function() { + location.href = location.pathname.replace(/\/browse\/.*/, ""); + } +} +document.addEventListener("DOMContentLoaded", setLink); diff -r fe29568da760 -r 2aaf73fe2cd4 lighttpd/slitaz-cooker.png Binary file lighttpd/slitaz-cooker.png has changed