Changeset 31 in code
Legend:
- Unmodified
- Added
- Removed
-
trunk/morty.go
r30 r31 110 110 <div id="mortyheader"> 111 111 <input type="checkbox" id="mortytoggle" autocomplete="off" /> 112 <div><p>This is a proxified and sanitized view of the page,<br />visit <a href="%s" >original site</a>.</p><div><p><label for="mortytoggle">hide</label></p></div></div>112 <div><p>This is a proxified and sanitized view of the page,<br />visit <a href="%s" rel="noreferrer">original site</a>.</p><p><label for="mortytoggle">hide</label></p></div> 113 113 </div> 114 114 <style> 115 #mortyheader { position: fixed; top: 15%%; left: 0; max-width: 10em; color: #444; overflow: hidden; z-index: 110000; font-size: 0.9em; padding: 1em 1em 1em 0; margin: 0; }116 #mortyheader a { color: #3498db; }117 #mortyheader p { padding: 0 ; margin: 0; }118 #mortyheader > div { padding: 8px; font-size: 0.9em; border-width: 4px 4px 4px 0; border-style: solid; border-color: #1abc9c; background: #FFF; line-height: 1em; }115 #mortyheader { position: fixed; padding: 12px 12px 12px 0; margin: 0; box-sizing: content-box; top: 15%%; left: 0; max-width: 140px; color: #444; overflow: hidden; z-index: 110000; font-size: 12px; line-height: normal; } 116 #mortyheader a { color: #3498db; font-weight: bold; } 117 #mortyheader p { padding: 0 0 0.7em 0; margin: 0; } 118 #mortyheader > div { padding: 8px; font-size: 12px !important; font-family: sans !important; border-width: 4px 4px 4px 0; border-style: solid; border-color: #1abc9c; background: #FFF; line-height: 1em; } 119 119 #mortyheader label { text-align: right; cursor: pointer; display: block; color: #444; padding: 0; margin: 0; } 120 120 input[type=checkbox]#mortytoggle { display: none; } … … 492 492 if bytes.Equal(http_equiv, []byte("refresh")) && urlIndex != -1 { 493 493 contentUrl := content[urlIndex+4:] 494 // special case of <meta http-equiv="refresh" content="0; url='example.com/url.with.quote.outside'">495 if len(contentUrl)>=2 && (contentUrl[0] == byte('\'') || contentUrl[0] == byte('"')) {496 if contentUrl[0] == contentUrl[len(contentUrl)-1] {497 contentUrl=contentUrl[1:len(contentUrl)-1]498 }499 }500 // output proxify result501 494 if uri, err := rc.ProxifyURI(string(contentUrl)); err == nil { 502 495 fmt.Fprintf(out, ` http-equiv="refresh" content="%surl=%s"`, content[:urlIndex], uri) … … 533 526 } 534 527 535 func mergeURIs(u1, u2 *url.URL) (*url.URL){528 func mergeURIs(u1, u2 *url.URL) *url.URL { 536 529 return u1.ResolveReference(u2) 537 530 } … … 597 590 <head> 598 591 <title>MortyProxy</title> 592 <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" /> 599 593 <style> 600 body { font-family: 'Garamond', 'Georgia', serif; text-align: center; color: #444; background: #FAFAFA; margin: 0; padding: 0; font-size: 1.1em; } 594 html { height: 100%; } 595 body { min-height : 100%; display: flex; flex-direction:column; font-family: 'Garamond', 'Georgia', serif; text-align: center; color: #444; background: #FAFAFA; margin: 0; padding: 0; font-size: 1.1em; } 601 596 input { border: 1px solid #888; padding: 0.3em; color: #444; background: #FFF; font-size: 1.1em; } 597 input[placeholder] { width:80%; } 602 598 a { text-decoration: none; #2980b9; } 603 599 h1, h2 { font-weight: 200; margin-bottom: 2rem; } 604 600 h1 { font-size: 3em; } 605 .footer { position: absolute; bottom: 2em; width: 100%; } 601 .container { flex:1; min-height: 100%; margin-bottom: 1em; } 602 .footer { margin: 1em; } 606 603 .footer p { font-size: 0.8em; } 607 608 604 </style> 609 605 </head> 610 606 <body> 611 <h1>MortyProxy</h1>`)) 607 <div class="container"> 608 <h1>MortyProxy</h1> 609 `)) 612 610 if err != nil { 613 611 ctx.SetStatusCode(404) … … 621 619 if p.Key == nil { 622 620 ctx.Write([]byte(` 623 <form action="post">624 Visit url: <input placeholder="https://url.." name="mortyurl"/>625 <input type="submit" value="go" />626 </form>`))621 <form action="post"> 622 Visit url: <input placeholder="https://url.." name="mortyurl" autofocus /> 623 <input type="submit" value="go" /> 624 </form>`)) 627 625 } else { 628 626 ctx.Write([]byte(`<h3>Warning! This instance does not support direct URL opening.</h3>`)) 629 627 } 630 628 ctx.Write([]byte(` 631 <div class="footer"> 632 <p>Morty rewrites web pages to exclude malicious HTML tags and CSS/HTML attributes. It also replaces external resource references to prevent third-party information leaks.<br /> 633 <a href="https://github.com/asciimoo/morty">view on github</a> 634 </p> 635 </div> 629 </div> 630 <div class="footer"> 631 <p>Morty rewrites web pages to exclude malicious HTML tags and CSS/HTML attributes. It also replaces external resource references to prevent third-party information leaks.<br /> 632 <a href="https://github.com/asciimoo/morty">view on github</a> 633 </p> 634 </div> 636 635 </body> 637 636 </html>`))
Note:
See TracChangeset
for help on using the changeset viewer.