瀏覽代碼

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram 7 年之前
父節點
當前提交
e1b96e4aa3
共有 4 個文件被更改,包括 188 次插入36 次删除
  1. 35
    11
      code-of-conduct.md
  2. 129
    21
      src/freedombone-app-cryptpad
  3. 21
    4
      src/freedombone-app-fedwiki
  4. 3
    0
      src/freedombone-image-mesh

+ 35
- 11
code-of-conduct.md 查看文件

1
-Instead of having some tedious *Code of Conduct* which tries to micro-manage how folks communicate privately with each other this project has a set of guiding principles, which are as follows:
2
-
3
- * Enable users to help themselves to provide their own personal software infrastructure.
4
- * Enable users to help each other to provide software infrastructure for a community.
5
- * Principle of self-management: apps should require miniumum configuration and maintain themselves as far as possible.
6
- * There should be no single point of failure. Assume that other servers can and will fail occasionally.
7
- * Minimum data retention. Only store the data which users actually want or need, and within apps implement the function which allows logging to be turned off.
8
- * Respect other users right to run their own stuff and have their own policies on their own hardware.
9
- * Remove as many intermediating organisations as possible. For example, Google tracking embedded within some Free Software apps.
10
- * No tollbooths, rent-seeking, gatekeepers or paywalls.
11
- * Maximize energy efficiency. No systems which fundamentally depend upon proof-of-work block solving or other compute-heavy methods. The target here is small single board computers.
1
+# Freedombone "Code of Conduct"
2
+
3
+## Be respectful
4
+
5
+In a project the size of Freedombone, inevitably there will be people with whom you may disagree, or find it difficult to cooperate. Accept that, but even so, remain respectful. Disagreement is no excuse for poor behaviour or personal attacks, and a community in which people feel threatened is not a healthy community.
6
+
7
+## Assume good faith
8
+
9
+Freedombone Contributors have many ways of reaching our common goal of providing freedom respecting internet or mesh systems which may differ from your ways. Assume that other people are working towards this goal.
10
+
11
+## Be collaborative
12
+
13
+Freedombone is a moderately complex project, though nothing big and professional like GNU. It's good to ask for help when you need it. Similarly, offers for help should be seen in the context of our shared goal of improving the system.
14
+
15
+When you make something for the benefit of the project, be willing to explain to others how it works, so that they can build on your work to make it even better.
16
+
17
+## Try to be concise
18
+
19
+If you're submitting documentation then keep in mind that what you write once could be read by many other people. To avoid TL;DR keep it as short and concise as possible. This will also reduce the amount of translations effort needed.
20
+
21
+If you're discussing an issue or bug, try to stay on topic, especially in discussions that are already fairly large.
22
+
23
+## Be open
24
+
25
+Most ways of communication used within Freedombone (eg Matrix/XMPP) allow for public and private communication. Prefer public methods of communication for Freedombone-related messages, unless posting something sensitive.
26
+
27
+This applies to messages for help, too; not only is a public support request much more likely to result in an answer to your question, it also makes sure that any inadvertent mistakes made by people answering your question will be more easily detected and corrected.
28
+
29
+## In case of problems
30
+
31
+While this code of conduct should be adhered to by participants, we recognize that sometimes people may have a bad day, or be unaware of some of the guidelines in this code of conduct. When that happens, you may reply to them and point out this code of conduct. Such messages may be in public or in private, whatever is most appropriate. However, regardless of whether the message is public or not, it should still adhere to the relevant parts of this code of conduct; in particular, it should not be abusive or disrespectful. Assume good faith; it is more likely that participants are unaware of their bad behaviour than that they intentionally try to degrade the quality of the discussion.
32
+
33
+Serious or persistent offenders will be kicked from chat rooms and any of their subsequent patches will be unlikely to be upstreamed.
34
+
35
+Complaints should be made (in private) to the maintainer or chat room admin. The typical email address can be found in the source code headers. Preferably use GPG/OpenPGP if you can, or XMPP with OTR/OMEMO to bob@freedombone.net.

+ 129
- 21
src/freedombone-app-cryptpad 查看文件

36
 
36
 
37
 CRYPTPAD_ONION_PORT=8119
37
 CRYPTPAD_ONION_PORT=8119
38
 CRYPTPAD_PORT=9003
38
 CRYPTPAD_PORT=9003
39
+CRYPTPAD_PORT2=9005
39
 CRYPTPAD_REPO="https://github.com/xwiki-labs/cryptpad"
40
 CRYPTPAD_REPO="https://github.com/xwiki-labs/cryptpad"
40
-CRYPTPAD_COMMIT='52d344c3d1404d75d2bf4ae8845e5c024e85ec7f'
41
+CRYPTPAD_COMMIT='cfc9ce33d6c7034a13cb0e6d606de6fba38697e0'
41
 CRYPTPAD_DIR=/etc/cryptpad
42
 CRYPTPAD_DIR=/etc/cryptpad
42
 
43
 
43
 cryptpad_variables=(ONION_ONLY)
44
 cryptpad_variables=(ONION_ONLY)
76
     fi
77
     fi
77
 }
78
 }
78
 
79
 
80
+function cryptpad_generate_api_config {
81
+    if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
82
+        mkdir -p $CRYPTPAD_DIR/customize/api
83
+    fi
84
+    wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
85
+    if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
86
+        echo $'Unable to wget api/config'
87
+        exit 89252
88
+    fi
89
+    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
90
+}
91
+
79
 function upgrade_cryptpad {
92
 function upgrade_cryptpad {
80
     CURR_CRYPTPAD_COMMIT=$(get_completion_param "cryptpad commit")
93
     CURR_CRYPTPAD_COMMIT=$(get_completion_param "cryptpad commit")
81
     if [[ "$CURR_CRYPTPAD_COMMIT" == "$CRYPTPAD_COMMIT" ]]; then
94
     if [[ "$CURR_CRYPTPAD_COMMIT" == "$CRYPTPAD_COMMIT" ]]; then
89
     set_repo_commit $CRYPTPAD_DIR "cryptpad commit" "$CRYPTPAD_COMMIT" $CRYPTPAD_REPO
102
     set_repo_commit $CRYPTPAD_DIR "cryptpad commit" "$CRYPTPAD_COMMIT" $CRYPTPAD_REPO
90
 
103
 
91
     cd $CRYPTPAD_DIR
104
     cd $CRYPTPAD_DIR
105
+    cryptpad_create_config
106
+    npm upgrade
92
     npm install
107
     npm install
108
+    su -c 'echo "2" | bower update' - cryptpad
109
+    su -c 'bower install --config.interactive=false' - cryptpad
110
+    cryptpad_generate_api_config
93
     chown -R cryptpad:cryptpad $CRYPTPAD_DIR
111
     chown -R cryptpad:cryptpad $CRYPTPAD_DIR
94
-    su -c 'bower install' - cryptpad
95
 
112
 
96
     systemctl start cryptpad
113
     systemctl start cryptpad
97
 }
114
 }
98
 
115
 
99
-
100
 function backup_local_cryptpad {
116
 function backup_local_cryptpad {
101
     source_directory=$CRYPTPAD_DIR/datastore
117
     source_directory=$CRYPTPAD_DIR/datastore
102
     if [ -d $source_directory ]; then
118
     if [ -d $source_directory ]; then
215
     userdel -r cryptpad
231
     userdel -r cryptpad
216
 }
232
 }
217
 
233
 
234
+function cryptpad_create_config {
235
+    cryptpad_install_type=$1
236
+
237
+    cryptpad_prefix=
238
+    if [[ "$cryptpad_install_type" == "mesh" ]]; then
239
+        cryptpad_prefix=$rootdir
240
+    fi
241
+
242
+    echo '/*@flow*/' > $cryptpad_prefix$CRYPTPAD_DIR/config.js
243
+    echo '/*' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
244
+    echo '  globals module' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
245
+    echo '*/' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
246
+    echo "var domain = ' http://localhost:${CRYPTPAD_PORT}/';" >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
247
+    echo 'module.exports = {' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
248
+    echo "        httpAddress: '::'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
249
+    echo '        httpHeaders: {' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
250
+    echo '                "X-XSS-Protection": "1; mode=block",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
251
+    echo '                "X-Content-Type-Options": "nosniff",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
252
+    echo '                "Access-Control-Allow-Origin": "*"' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
253
+    echo '        },' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
254
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
255
+    echo '        contentSecurity: [' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
256
+    echo "                \"default-src 'none'\"," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
257
+    echo "                \"style-src 'unsafe-inline' 'self' \" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
258
+    echo "                \"script-src 'self'\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
259
+    echo "                \"font-src 'self' data:\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
260
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
261
+    echo '                "child-src blob: *",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
262
+    echo '                "frame-src blob: *",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
263
+    echo '                "media-src * blob:",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
264
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
265
+    echo "                \"connect-src 'self' ws: wss: blob:\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
266
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
267
+    echo "                \"img-src 'self' data: blob:\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
268
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
269
+    echo '                "frame-ancestors *",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
270
+    echo "        ].join('; ')," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
271
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
272
+    echo '        padContentSecurity: [' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
273
+    echo "                \"default-src 'none'\"," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
274
+    echo "                \"style-src 'unsafe-inline' 'self'\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
275
+    echo "                \"script-src 'self' 'unsafe-eval' 'unsafe-inline'\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
276
+    echo "                \"font-src 'self'\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
277
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
278
+    echo '                "child-src *",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
279
+    echo '                "frame-src *",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
280
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
281
+    echo "                \"connect-src 'self' ws: wss:\" + domain," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
282
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
283
+    echo '                "img-src * blob:",' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
284
+    echo "        ].join('; ')," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
285
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
286
+    echo "        httpPort: ${CRYPTPAD_PORT}," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
287
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
288
+    echo '        // This is for allowing the cross-domain iframe to function when developing' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
289
+    echo "        httpSafePort: ${CRYPTPAD_PORT2}," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
290
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
291
+    echo "        websocketPath: '/cryptpad_websocket'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
292
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
293
+    echo '        logToStdout: false,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
294
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
295
+    echo '        verbose: false,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
296
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
297
+    echo '        mainPages: [' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
298
+    echo "                'index'" >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
299
+    echo '        ],' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
300
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
301
+    echo '        removeDonateButton: true,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
302
+    echo '        allowSubscriptions: false,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
303
+    if [[ "$cryptpad_install_type" == "mesh" ]]; then
304
+        echo "        myDomain: 'http://P${PEER_ID}.local'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
305
+    else
306
+        CRYPTPAD_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_cryptpad/hostname)
307
+        echo "        myDomain: 'http://${CRYPTPAD_ONION_HOSTNAME}'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
308
+    fi
309
+    echo '        defaultStorageLimit: 50 * 1024 * 1024,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
310
+
311
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
312
+    echo '        customLimits: {' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
313
+    echo '        },' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
314
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
315
+    echo '        adminEmail: false,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
316
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
317
+    echo "        storage: './storage/file'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
318
+    echo '' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
319
+    echo "       filePath: './datastore/'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
320
+    echo "        pinPath: './pins'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
321
+    echo "        blobPath: './blob'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
322
+    echo "        blobStagingPath: './blobstage'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
323
+    echo '        channelExpirationMs: 30000,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
324
+    echo '        openFileLimit: 1024,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
325
+    echo "        rpc: './rpc.js'," >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
326
+    echo '        suppressRPCErrors: false,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
327
+    echo '        enableUploads: true,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
328
+    echo '        //restrictUploads: false,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
329
+    echo '        maxUploadSize: 20 * 1024 * 1024,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
330
+    echo '        //logFeedback: true,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
331
+    echo '        //logRPC: true,' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
332
+    echo '};' >> $cryptpad_prefix$CRYPTPAD_DIR/config.js
333
+    chown cryptpad:cryptpad $cryptpad_prefix$CRYPTPAD_DIR/config.js
334
+}
335
+
218
 function mesh_install_cryptpad {
336
 function mesh_install_cryptpad {
219
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
337
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
220
         return
338
         return
343
 
461
 
344
     rm $rootdir/usr/bin/install_cryptpad
462
     rm $rootdir/usr/bin/install_cryptpad
345
 
463
 
346
-    sed -i "s|httpPort:.*|httpPort: $CRYPTPAD_PORT,|g" $rootdir$CRYPTPAD_DIR/config.js
347
-    sed -i "s|// domain:|domain:|g" $rootdir$CRYPTPAD_DIR/config.js
348
-    sed -i 's|openFileLimit:.*|openFileLimit: 1024,|g' $rootdir$CRYPTPAD_DIR/config.js
349
-    sed -i "s|domain:.*|domain: 'http://P${PEER_ID}.local',|g" $rootdir$CRYPTPAD_DIR/config.js
464
+    cryptpad_create_config mesh
350
 
465
 
351
     chroot "$rootdir" chown -R cryptpad:cryptpad $CRYPTPAD_DIR
466
     chroot "$rootdir" chown -R cryptpad:cryptpad $CRYPTPAD_DIR
352
 
467
 
422
     echo '' >> $cryptpad_nginx_site
537
     echo '' >> $cryptpad_nginx_site
423
     echo '  index index.html;' >> $cryptpad_nginx_site
538
     echo '  index index.html;' >> $cryptpad_nginx_site
424
     echo '' >> $cryptpad_nginx_site
539
     echo '' >> $cryptpad_nginx_site
540
+    echo '  if ($args ~ ver=) {' >> $cryptpad_nginx_site
541
+    echo '      set $cacheControl max-age=31536000;' >> $cryptpad_nginx_site
542
+    echo '  }' >> $cryptpad_nginx_site
543
+    echo '  add_header Cache-Control $cacheControl;' >> $cryptpad_nginx_site
544
+    echo '' >> $cryptpad_nginx_site
425
     echo '  add_header X-XSS-Protection "1; mode=block";' >> $cryptpad_nginx_site
545
     echo '  add_header X-XSS-Protection "1; mode=block";' >> $cryptpad_nginx_site
426
     echo '  add_header X-Content-Type-Options nosniff;' >> $cryptpad_nginx_site
546
     echo '  add_header X-Content-Type-Options nosniff;' >> $cryptpad_nginx_site
427
     echo '  add_header X-Frame-Options SAMEORIGIN;' >> $cryptpad_nginx_site
547
     echo '  add_header X-Frame-Options SAMEORIGIN;' >> $cryptpad_nginx_site
510
         exit 628252
630
         exit 628252
511
     fi
631
     fi
512
 
632
 
513
-    sed -i "s|httpPort:.*|httpPort: $CRYPTPAD_PORT,|g" config.js
514
-    sed -i "s|// domain:|domain:|g" config.js
515
-    sed -i 's|openFileLimit:.*|openFileLimit: 1024,|g' config.js
516
-    sed -i "s|domain:.*|domain: 'http://$CRYPTPAD_ONION_HOSTNAME',|g" config.js
517
-
633
+    cryptpad_create_config
518
     chown -R cryptpad:cryptpad $CRYPTPAD_DIR
634
     chown -R cryptpad:cryptpad $CRYPTPAD_DIR
519
 
635
 
520
     # daemon
636
     # daemon
540
 
656
 
541
     sleep 6
657
     sleep 6
542
 
658
 
543
-    if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
544
-        mkdir -p $CRYPTPAD_DIR/customize/api
545
-    fi
546
-    wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
547
-    if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
548
-        echo $'Unable to wget api/config'
549
-        exit 89252
550
-    fi
551
-    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
659
+    cryptpad_generate_api_config
552
 
660
 
553
     # install again
661
     # install again
554
     cd $CRYPTPAD_DIR
662
     cd $CRYPTPAD_DIR

+ 21
- 4
src/freedombone-app-fedwiki 查看文件

28
 # You should have received a copy of the GNU Affero General Public License
28
 # You should have received a copy of the GNU Affero General Public License
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 
30
 
31
-VARIANTS=""
31
+VARIANTS="full full-vim media"
32
 
32
 
33
 IN_DEFAULT_INSTALL=0
33
 IN_DEFAULT_INSTALL=0
34
 SHOW_ON_ABOUT=1
34
 SHOW_ON_ABOUT=1
39
 FEDWIKI_ONION_PORT=8131
39
 FEDWIKI_ONION_PORT=8131
40
 FEDWIKI_PORT=3053
40
 FEDWIKI_PORT=3053
41
 FEDWIKI_DATA=/var/lib/fedwiki
41
 FEDWIKI_DATA=/var/lib/fedwiki
42
+FEDWIKI_COOKIE=
42
 
43
 
43
 fedwiki_variables=(FEDWIKI_DOMAIN_NAME
44
 fedwiki_variables=(FEDWIKI_DOMAIN_NAME
44
                    FEDWIKI_CODE
45
                    FEDWIKI_CODE
46
+                   FEDWIKI_COOKIE
45
                    FEDWIKI_ADMIN_PASSWORD
47
                    FEDWIKI_ADMIN_PASSWORD
46
                    ONION_ONLY
48
                    ONION_ONLY
47
                    DDNS_PROVIDER
49
                    DDNS_PROVIDER
80
     if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2 ]; then
82
     if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2 ]; then
81
         rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2
83
         rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2
82
     fi
84
     fi
85
+
86
+    if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-twitter ]; then
87
+        rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-twitter
88
+    fi
89
+
90
+    if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-github ]; then
91
+        rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-github
92
+    fi
83
 }
93
 }
84
 
94
 
85
 function logging_on_fedwiki {
95
 function logging_on_fedwiki {
303
         function_check nginx_ssl
313
         function_check nginx_ssl
304
         nginx_ssl $FEDWIKI_DOMAIN_NAME mobile
314
         nginx_ssl $FEDWIKI_DOMAIN_NAME mobile
305
 
315
 
316
+        sed -i '/Content-Security-Policy/d' $fedwiki_nginx_file
317
+        sed -i '/X-XSS-Protection/d' $fedwiki_nginx_file
318
+        sed -i '/X-Robots-Tag/d' $fedwiki_nginx_file
319
+        sed -i '/X-Download-Options/d' $fedwiki_nginx_file
320
+        sed -i '/X-Permitted-Cross-Domain-Policies/d' $fedwiki_nginx_file
321
+
306
         echo '  add_header X-Robots-Tag none;' >> $fedwiki_nginx_file
322
         echo '  add_header X-Robots-Tag none;' >> $fedwiki_nginx_file
307
         echo '  add_header X-Download-Options noopen;' >> $fedwiki_nginx_file
323
         echo '  add_header X-Download-Options noopen;' >> $fedwiki_nginx_file
308
         echo '  add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file
324
         echo '  add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file
395
 
411
 
396
     FEDWIKI_ONION_HOSTNAME=$(add_onion_service fedwiki 80 ${FEDWIKI_ONION_PORT})
412
     FEDWIKI_ONION_HOSTNAME=$(add_onion_service fedwiki 80 ${FEDWIKI_ONION_PORT})
397
 
413
 
398
-    #TODO add a config file for the identity system
399
-    # $FEDWIKI_DATA/config.json
414
+    if [ ! $FEDWIKI_COOKIE ]; then
415
+        FEDWIKI_COOKIE="$(create_password 30)$(create_password 30)$(create_password 30)"
416
+    fi
400
 
417
 
401
     echo '[Unit]' > /etc/systemd/system/fedwiki.service
418
     echo '[Unit]' > /etc/systemd/system/fedwiki.service
402
     echo 'Description=Fedwiki Decentralized video streaming platform' >> /etc/systemd/system/fedwiki.service
419
     echo 'Description=Fedwiki Decentralized video streaming platform' >> /etc/systemd/system/fedwiki.service
407
     echo 'User=fedwiki' >> /etc/systemd/system/fedwiki.service
424
     echo 'User=fedwiki' >> /etc/systemd/system/fedwiki.service
408
     echo 'Group=fedwiki' >> /etc/systemd/system/fedwiki.service
425
     echo 'Group=fedwiki' >> /etc/systemd/system/fedwiki.service
409
     echo "WorkingDirectory=/usr/local/lib/node_modules/wiki" >> /etc/systemd/system/fedwiki.service
426
     echo "WorkingDirectory=/usr/local/lib/node_modules/wiki" >> /etc/systemd/system/fedwiki.service
410
-    echo "ExecStart=/usr/local/bin/wiki --config $FEDWIKI_DATA/config.json --data $FEDWIKI_DATA -p $FEDWIKI_PORT" >> /etc/systemd/system/fedwiki.service
427
+    echo "ExecStart=/usr/local/bin/wiki --security_type friends --cookieSecret '${FEDWIKI_COOKIE}' --session_duration 7 --data $FEDWIKI_DATA -p $FEDWIKI_PORT" >> /etc/systemd/system/fedwiki.service
411
     echo 'StandardOutput=syslog' >> /etc/systemd/system/fedwiki.service
428
     echo 'StandardOutput=syslog' >> /etc/systemd/system/fedwiki.service
412
     echo 'StandardError=syslog' >> /etc/systemd/system/fedwiki.service
429
     echo 'StandardError=syslog' >> /etc/systemd/system/fedwiki.service
413
     echo 'SyslogIdentifier=fedwiki' >> /etc/systemd/system/fedwiki.service
430
     echo 'SyslogIdentifier=fedwiki' >> /etc/systemd/system/fedwiki.service

+ 3
- 0
src/freedombone-image-mesh 查看文件

155
     if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
155
     if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
156
         mkdir -p $CRYPTPAD_DIR/customize/api
156
         mkdir -p $CRYPTPAD_DIR/customize/api
157
     fi
157
     fi
158
+    if [ -f $CRYPTPAD_DIR/config.js ]; then
159
+        sed -i "s|myDomain:.*|myDomain: 'http://P${PEER_ID}.local',|g" $CRYPTPAD_DIR/config.js
160
+    fi
158
     wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
161
     wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
159
     if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
162
     if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
160
         echo $'Unable to wget api/config'
163
         echo $'Unable to wget api/config'