-
Notifications
You must be signed in to change notification settings - Fork 2
/
post.sh
56 lines (43 loc) · 799 Bytes
/
post.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
if ! test -e ./params.sh
then
exit 1
fi
. ./params.sh
thread=$1
if [ ! "$thread" ]
then
echo "Thread does not exist"
exit 1
fi
stamp=$(date +%s)
if [ -e posts ]
then
no=$(cat posts)
else
no=0
fi
no=$(($no + 1))
post="$stamp"_"$no"
# post id
if test "$ENABLE_POST_IDS" = y
then
postid=$(sh tripcode.sh "$SALT_DIR" "$SERVER_HOST")
echo "${no} ${postid}" >> postids
fi
# tripcode
read -p "Tripcode: " password
if test -n "$password"
then
tripcode=$(sh tripcode.sh "$SALT_DIR" "$password")
echo "${no} ${tripcode}" >> tripcodes
fi
touch $thread/$post
vi $thread/$post
sh updatepostcache.sh $thread $post >> $thread/postcache
if test "$MAX_RSS_ITEMS" -gt 0
then
sh updaterss.sh $thread $no "$(cat $thread/$post)"
fi
echo $no > posts
sh updatethreadcache.sh > threadcache