@rip-lang/server 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browse.rip +1 -1
- package/package.json +1 -1
- package/serving/static.rip +2 -2
package/browse.rip
CHANGED
|
@@ -27,7 +27,7 @@ notFound ->
|
|
|
27
27
|
url = new URL(@req.url)
|
|
28
28
|
reqPath = try decodeURIComponent(url.pathname) catch then url.pathname
|
|
29
29
|
path = resolve(root, reqPath.slice(1))
|
|
30
|
-
viewSource = url.search is '?'
|
|
30
|
+
viewSource = url.search is '?view'
|
|
31
31
|
|
|
32
32
|
unless path is root or path.startsWith(rootSlash)
|
|
33
33
|
return new Response 'Not Found', { status: 404 }
|
package/package.json
CHANGED
package/serving/static.rip
CHANGED
|
@@ -189,7 +189,7 @@ export renderDirectoryListing = (reqPath, fsPath, rootName) ->
|
|
|
189
189
|
</table>
|
|
190
190
|
</div></div>
|
|
191
191
|
<script>
|
|
192
|
-
!function(){var p,c,ox=14,oy=14;function mk(){if(p)return p;p=document.createElement('div');p.className='pop';p.innerHTML='<div class="pop-b"></div>';document.body.appendChild(p);return p}function show(a,e){var s=a.dataset.src;if(!s)return;var el=mk(),b=el.firstChild;b.innerHTML='';var img=new Image();img.src=s;b.appendChild(img);c=a;el.classList.add('on');place(e.clientX,e.clientY)}function hide(){c=null;if(p)p.classList.remove('on')}function place(x,y){if(!p)return;var r=p.getBoundingClientRect(),m=12,l=x+ox,t=y+oy;if(l+r.width>innerWidth-m)l=x-r.width-ox;if(t+r.height>innerHeight-m)t=innerHeight-r.height-m;if(l<m)l=m;if(t<m)t=m;p.style.left=l+'px';p.style.top=t+'px'}document.addEventListener('mouseover',function(e){var a=e.target.closest('[data-pv]');if(a)show(a,e)});document.addEventListener('mousemove',function(e){if(c)place(e.clientX,e.clientY)});document.addEventListener('mouseout',function(e){var a=e.target.closest('[data-pv]');if(a&&a===c)hide()});document.addEventListener('scroll',hide,{passive:true});document.addEventListener('keydown',function(e){if(e.key==='Escape')hide()});window.addEventListener('blur',hide);var dt=0;document.addEventListener('click',function(e){var a=e.target.closest('td.nm a');if(!a)return;var h=a.getAttribute('href');if(!h||h.endsWith('/'))return;e.preventDefault();clearTimeout(dt);dt=setTimeout(function(){location.href=h},250)});document.addEventListener('dblclick',function(e){var a=e.target.closest('td.nm a');if(!a)return;var h=a.getAttribute('href');if(!h||h.endsWith('/'))return;e.preventDefault();clearTimeout(dt);location.href=h+'?'})}();
|
|
192
|
+
!function(){var p,c,ox=14,oy=14;function mk(){if(p)return p;p=document.createElement('div');p.className='pop';p.innerHTML='<div class="pop-b"></div>';document.body.appendChild(p);return p}function show(a,e){var s=a.dataset.src;if(!s)return;var el=mk(),b=el.firstChild;b.innerHTML='';var img=new Image();img.src=s;b.appendChild(img);c=a;el.classList.add('on');place(e.clientX,e.clientY)}function hide(){c=null;if(p)p.classList.remove('on')}function place(x,y){if(!p)return;var r=p.getBoundingClientRect(),m=12,l=x+ox,t=y+oy;if(l+r.width>innerWidth-m)l=x-r.width-ox;if(t+r.height>innerHeight-m)t=innerHeight-r.height-m;if(l<m)l=m;if(t<m)t=m;p.style.left=l+'px';p.style.top=t+'px'}document.addEventListener('mouseover',function(e){var a=e.target.closest('[data-pv]');if(a)show(a,e)});document.addEventListener('mousemove',function(e){if(c)place(e.clientX,e.clientY)});document.addEventListener('mouseout',function(e){var a=e.target.closest('[data-pv]');if(a&&a===c)hide()});document.addEventListener('scroll',hide,{passive:true});document.addEventListener('keydown',function(e){if(e.key==='Escape')hide()});window.addEventListener('blur',hide);var dt=0;document.addEventListener('click',function(e){var a=e.target.closest('td.nm a');if(!a)return;var h=a.getAttribute('href');if(!h||h.endsWith('/'))return;e.preventDefault();clearTimeout(dt);dt=setTimeout(function(){location.href=h},250)});document.addEventListener('dblclick',function(e){var a=e.target.closest('td.nm a');if(!a)return;var h=a.getAttribute('href');if(!h||h.endsWith('/'))return;e.preventDefault();clearTimeout(dt);location.href=h+'?view'})}();
|
|
193
193
|
</script>
|
|
194
194
|
</body>
|
|
195
195
|
</html>
|
|
@@ -376,7 +376,7 @@ export serveStaticRoute = (req, url, route) ->
|
|
|
376
376
|
return new Response(html, { headers: { 'content-type': 'text/html; charset=UTF-8' } })
|
|
377
377
|
if stat.isFile()
|
|
378
378
|
if route.browse and acceptsHtml(req)
|
|
379
|
-
viewSource = url.search is '?'
|
|
379
|
+
viewSource = url.search is '?view'
|
|
380
380
|
if filePath.endsWith('.md') and not viewSource
|
|
381
381
|
html = renderMarkdown(filePath)
|
|
382
382
|
return new Response(html, { headers: { 'content-type': 'text/html; charset=UTF-8' } })
|