Pastebin

Check-in [353077eadb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improve rendering on mobile phones
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 353077eadbfb3bbcbad578e56b4cbd1546b07b5874c47cf9ae9231a4d1ebc418
User & Date: jef 2019-11-11 08:56:12
Context
2019-11-11
09:00
Fix unescaped percent sign in template check-in: 180e929af4 user: jef tags: trunk
08:56
Improve rendering on mobile phones check-in: 353077eadb user: jef tags: trunk
2019-11-06
21:03
Custom error message on invalid paste check-in: 064b0cd9a2 user: jef tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
	# (section title is erased using a perl on liner)
	@mandoc -I os="" -T locale $(PROG).1 \
		| col -bx \
		| perl -pe 's/^(\S+\(\d\))(\s+.*\s+)\1$$/$$1 . " " x length($$2) . $$1/e' \
		> $(PROG).1.txt
	
pastebin: $(GOFILES)
	go build -ldflags="-s -w"

install: $(PROG) $(PROG).1
	mkdir -p $(PREFIX)/bin
	cp -f $(PROG) $(PREFIX)/bin
	chmod 0755 $(PREFIX)/bin/$(PROG)
	mkdir -p $(MANPREFIX)/man1
	cp -f $(PROG).1 $(MANPREFIX)/man1







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
	# (section title is erased using a perl on liner)
	@mandoc -I os="" -T locale $(PROG).1 \
		| col -bx \
		| perl -pe 's/^(\S+\(\d\))(\s+.*\s+)\1$$/$$1 . " " x length($$2) . $$1/e' \
		> $(PROG).1.txt
	
pastebin: $(GOFILES)
	go build -ldflags "-s -w"

install: $(PROG) $(PROG).1
	mkdir -p $(PREFIX)/bin
	cp -f $(PROG) $(PREFIX)/bin
	chmod 0755 $(PREFIX)/bin/$(PROG)
	mkdir -p $(MANPREFIX)/man1
	cp -f $(PROG).1 $(MANPREFIX)/man1

Changes to client/pastebin-client.

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash
#
# Command line pastebin client

PASTEURL="<insert paste url here>"
APIKEY="<insert API key here"

function usage() {
	local progname=${0##*/}

	cat <<-EOF
	Command line pastebin client
	Usage:





|







1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash
#
# Command line pastebin client

PASTEURL="<insert paste url here>"
APIKEY="<insert API key here>"

function usage() {
	local progname=${0##*/}

	cat <<-EOF
	Command line pastebin client
	Usage:

Changes to go.mod.

1
2
3
4
5
6
7
8
module pastebin

go 1.13

require (
	github.com/gabriel-vasile/mimetype v0.3.21
	github.com/mattn/go-sqlite3 v1.11.0
)
|




|


1
2
3
4
5
6
7
8
module foutaise.org/fossil/pastebin

go 1.13

require (
	github.com/gabriel-vasile/mimetype v0.3.22
	github.com/mattn/go-sqlite3 v1.11.0
)

Changes to go.sum.

1
2
3
4
github.com/gabriel-vasile/mimetype v0.3.21 h1:Mc81ydjjIFN3Ir12WJ4myhnMs6cFAIlthU7MKY6XAIk=
github.com/gabriel-vasile/mimetype v0.3.21/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To=
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
|


1
2
3
4
github.com/gabriel-vasile/mimetype v0.3.22 h1:a41DjO1eMdhVj7kJFIhLVeHlInOIB5E3kqvpA+xSp70=
github.com/gabriel-vasile/mimetype v0.3.22/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To=
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=

Changes to http.go.

94
95
96
97
98
99
100

101
102
103
104
105
106
107
108
109



110
111
112
113
114
115
116
117
118
119
120
121
122

	w.Header().Add("Content-Type", "text/html; charset=utf-8")
	fmt.Fprintf(w,
		`<!doctype html>
<html lang="en">
  <head>
    <meta charset='utf-8'/>

    <title>Pastebin</title>
    <style>
      h1 {
        font-family: sans-serif;
        font-size: 120%%;
      }
      form {
        margin-bottom: 2em;
      }



    </style>
  </head>
  <body>
    <h1>New paste:</h1>
    <form method="POST">
      <textarea name="data" rows="25" cols="80"></textarea><br/>
      <input name="submit" value="Upload" type="submit">
    </form>
    <h1>Upload file:</h1>
    <form method="POST" enctype="multipart/form-data">
      <input type="file" name="data"/><br/>
      <input name="submit" value="Upload" type="submit">
    </form>







>









>
>
>





|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

	w.Header().Add("Content-Type", "text/html; charset=utf-8")
	fmt.Fprintf(w,
		`<!doctype html>
<html lang="en">
  <head>
    <meta charset='utf-8'/>
    <meta name='viewport' content='width=device-width, initial-scale=1'/>
    <title>Pastebin</title>
    <style>
      h1 {
        font-family: sans-serif;
        font-size: 120%%;
      }
      form {
        margin-bottom: 2em;
      }
      textarea {
        width: 95%;
      }
    </style>
  </head>
  <body>
    <h1>New paste:</h1>
    <form method="POST">
      <textarea name="data" rows="25"></textarea><br/>
      <input name="submit" value="Upload" type="submit">
    </form>
    <h1>Upload file:</h1>
    <form method="POST" enctype="multipart/form-data">
      <input type="file" name="data"/><br/>
      <input name="submit" value="Upload" type="submit">
    </form>