Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Scraps
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Neural Short-Circuit
Scraps
Commits
10c57b29
Commit
10c57b29
authored
Jul 02, 2014
by
Ronny Bangsund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added mutex.
parent
6968a570
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
webpanel.go
webpanel.go
+4
-2
No files found.
webpanel.go
View file @
10c57b29
...
...
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/hoisie/web"
"html/template"
"sync"
"time"
)
...
...
@@ -27,6 +28,7 @@ type ScrapLink struct {
var
indexTemplate
,
indexerr
=
template
.
ParseFiles
(
"tpl/index.tpl"
)
var
links
=
[]
ScrapLink
{}
var
share
sync
.
Mutex
func
initWeb
()
{
info
(
"Launching web service."
)
...
...
@@ -61,7 +63,6 @@ func get_index(ctx *web.Context, arg string) {
var
lang
string
if
arg
!=
""
{
s
=
loadScrap
(
sane
(
arg
))
info
(
"Links: %d (%d)"
,
len
(
links
),
len
(
scraps
))
if
!
s
.
hasExpired
()
{
view
=
true
lang
=
s
.
Language
...
...
@@ -126,13 +127,14 @@ func post_scrap(ctx *web.Context) {
func
buildLinks
()
{
i
:=
0
share
.
Lock
()
links
=
[]
ScrapLink
{}
for
_
,
v
:=
range
scraps
{
links
=
append
(
links
,
ScrapLink
{
v
.
Hash
,
v
.
Title
,
v
.
User
})
info
(
"Title %d:%s"
,
i
,
v
.
Title
)
i
++
if
i
>
9
{
break
}
}
share
.
Unlock
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment