From 804aa45fbbaf034b09b0f63ebe75630f02b32052 Mon Sep 17 00:00:00 2001 From: Karl Semich <0xloem@gmail.com> Date: Thu, 9 Jun 2016 18:08:08 -0400 Subject: Convert update.py to use more python --- backend/auth/freesitemgr/.config | 7 + backend/auth/freesitemgr/.gitignore | 1 + .../freesitemgr/Standing With Resilience Public | 611 +++++++++++++++++++++ backend/freesitemgr/.config | 7 - backend/freesitemgr/.gitignore | 1 - .../freesitemgr/Standing With Resilience Public | 512 ----------------- backend/resilient/__init__.py | 107 ++++ backend/resilient/freenet.py | 30 + backend/update.py | 148 ++--- 9 files changed, 806 insertions(+), 618 deletions(-) create mode 100644 backend/auth/freesitemgr/.config create mode 100644 backend/auth/freesitemgr/.gitignore create mode 100644 backend/auth/freesitemgr/Standing With Resilience Public delete mode 100644 backend/freesitemgr/.config delete mode 100644 backend/freesitemgr/.gitignore delete mode 100644 backend/freesitemgr/Standing With Resilience Public create mode 100644 backend/resilient/__init__.py create mode 100644 backend/resilient/freenet.py (limited to 'backend') diff --git a/backend/auth/freesitemgr/.config b/backend/auth/freesitemgr/.config new file mode 100644 index 0000000..23242e6 --- /dev/null +++ b/backend/auth/freesitemgr/.config @@ -0,0 +1,7 @@ +# freesitemgr configuration file +# managed by freesitemgr - edit with utmost care + +# FCP access details +fcpHost = '127.0.0.1' +fcpPort = 9481 + diff --git a/backend/auth/freesitemgr/.gitignore b/backend/auth/freesitemgr/.gitignore new file mode 100644 index 0000000..31d13b9 --- /dev/null +++ b/backend/auth/freesitemgr/.gitignore @@ -0,0 +1 @@ +Standing With Resilience diff --git a/backend/auth/freesitemgr/Standing With Resilience Public b/backend/auth/freesitemgr/Standing With Resilience Public new file mode 100644 index 0000000..bd065c5 --- /dev/null +++ b/backend/auth/freesitemgr/Standing With Resilience Public @@ -0,0 +1,611 @@ +# freesitemgr state file for freesite 'Standing With Resilience Public' +# managed by freesitemgr - edit only with the utmost care + +# general site config items + +name = "Standing With Resilience Public" +dir = "../html" +uriPriv = "USK@AKL0griFs7T25yw6-JR3Wk7vocvNBelOLg3RwtIL6aTp,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQECAAE/Standing With Resilience Public/6" +uriPub = "USK@hCLgfaINNSNAl4do-PapEincQP5Lxa72d8mFrzHqzqU,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQACAAE/Standing With Resilience Public/6/" +updateInProgress = False +insertingManifest = False +insertingIndex = True +index = "index.html" +sitemap = "sitemap.html" +mtype = "text/html" + +# Detailed site contents +files = [ + { + "mimetype": "application/octet-stream", + "hash": "acbaef275e46a7f14c1ef456fff2c8bbe8c84724", + "name": ".git/HEAD", + "uri": "", + "sizebytes": 23, + "state": "changed", + "path": "../html/.git/HEAD", + "id": "", + "target": "manifest" + }, + { + "mimetype": "application/octet-stream", + "hash": "c879df015d97615050afa7b9641e3352a1e701ac", + "name": ".git/info/exclude", + "uri": "", + "sizebytes": 240, + "state": "changed", + "path": "../html/.git/info/exclude", + "id": "", + "target": "manifest" + }, + { + "mimetype": "application/octet-stream", + "hash": "25d587813b49215224a7a793a45ef3ef943acfbb", + "name": ".git/info/refs", + "uri": "", + "sizebytes": 830, + "state": "changed", + "path": "../html/.git/info/refs", + "id": "", + "target": "manifest" + }, + { + "mimetype": "application/octet-stream", + "hash": "12d50a68f3e96240f0dfad5c80e1bb06477756e4", + "name": ".git/objects/info/packs", + "uri": "", + "sizebytes": 54, + "state": "changed", + "path": "../html/.git/objects/info/packs", + "id": "", + "target": "manifest" + }, + { + "mimetype": "application/octet-stream", + "hash": "0d323ed855a92cd783861198b724421fd4acdbb0", + "name": ".git/objects/pack/pack-be2270dfe9596c7f6afe3bd427ada432616f9f78.idx", + "uri": "", + "sizebytes": 5804, + "state": "changed", + "path": "../html/.git/objects/pack/pack-be2270dfe9596c7f6afe3bd427ada432616f9f78.idx", + "id": "", + "target": "manifest" + }, + { + "mimetype": "application/octet-stream", + "hash": "88225bedcbc17d9984ee27e07e059d1863fd1f23", + "name": ".git/objects/pack/pack-be2270dfe9596c7f6afe3bd427ada432616f9f78.pack", + "uri": "", + "sizebytes": 39150, + "state": "changed", + "path": "../html/.git/objects/pack/pack-be2270dfe9596c7f6afe3bd427ada432616f9f78.pack", + "id": "", + "target": "manifest" + }, + { + "mimetype": "application/octet-stream", + "hash": "4e39a3bdfc4b9c16e239ba29448f00e5a4fabc2a", + "name": ".git/packed-refs", + "uri": "", + "sizebytes": 803, + "state": "changed", + "path": "../html/.git/packed-refs", + "id": "", + "target": "manifest" + }, + { + "mimetype": "application/octet-stream", + "hash": "d9427cda09aba1cdde5c69c2b13c905bddb0bc51", + "name": ".git/refs/remotes/origin/HEAD", + "uri": "", + "sizebytes": 32, + "state": "changed", + "path": "../html/.git/refs/remotes/origin/HEAD", + "id": "", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "5cac9ddc5e3a5e68678fe42a42f9cbe96450ce00", + "name": "Freenet/index.html", + "uri": "", + "sizebytes": 2528, + "state": "changed", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Freenet/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|Freenet/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "5f1c62841949ce0b84c55963e3e2dc7e7c9834af", + "name": "Shielding/index.html", + "uri": "", + "sizebytes": 6115, + "state": "changed", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Shielding/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|Shielding/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "67391e3ea6615bca459dfdc7a03ce66729fd02bf", + "name": "TODO/index.html", + "uri": "", + "sizebytes": 2142, + "state": "changed", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/TODO/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|TODO/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "c5e4668d9c81b8019ef95a2603b210fb965f32b3", + "name": "Tech_Savvy/index.html", + "uri": "", + "sizebytes": 1351, + "state": "changed", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Tech_Savvy/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|Tech_Savvy/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "a6e409ad8eb6fefd8a5da89fd3ee567437e860d2", + "name": "Technical_Resources/index.html", + "uri": "", + "sizebytes": 1301, + "state": "changed", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Technical_Resources/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|Technical_Resources/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "5fd73c3c1c927d5467767e2a5dc74498a1d9a1f0", + "name": "ZeroNet/index.html", + "uri": "", + "sizebytes": 2034, + "state": "changed", + "path": "../html/ZeroNet/index.html", + "id": "freesitemgr|Standing With Resilience Public|ZeroNet/index.html", + "target": "manifest" + }, + { + "mimetype": "image/x-icon", + "hash": "8d06e9596fe48d7afd629fb4dca33f77deaa3454", + "name": "favicon.ico", + "uri": "", + "sizebytes": 371, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/favicon.ico", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|favicon.ico", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "a52f263074f721782dd4f156ba60476cecdaf15e", + "name": "ikiwiki/directive/index.html", + "uri": "", + "sizebytes": 3290, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/directive/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/directive/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "1dee7e4fe7fb96e78b5d29dd5ab0e6007b3e0f14", + "name": "ikiwiki/formatting/index.html", + "uri": "", + "sizebytes": 3539, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/formatting/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/formatting/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "f4d034a4e642fe5052f05b82ba43e0e160db305e", + "name": "ikiwiki/index.html", + "uri": "", + "sizebytes": 1707, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/index.html", + "target": "manifest" + }, + { + "mimetype": "application/x-javascript", + "hash": "cb5af1fc93aa1ca43f48712a29b804c62022daa6", + "name": "ikiwiki/jquery.min.js", + "uri": "", + "sizebytes": 101525, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/jquery.min.js", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/jquery.min.js", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "3f77190fadf80f13b41698b127c4a78cdc9cc1d4", + "name": "ikiwiki/markdown/index.html", + "uri": "", + "sizebytes": 1841, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/markdown/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/markdown/index.html", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "4a2f38c17e72fa05328b4221385f070878f5a8a4", + "name": "ikiwiki/openid/aol.png", + "uri": "", + "sizebytes": 460, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/aol.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/aol.png", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "2569b6eff0969180a0c2c8b7403f1acb400028b7", + "name": "ikiwiki/openid/goa-account-flickr.png", + "uri": "", + "sizebytes": 592, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/goa-account-flickr.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/goa-account-flickr.png", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "ca326227916ee2305acfa66a77b5fb18288b09f8", + "name": "ikiwiki/openid/goa-account-google.png", + "uri": "", + "sizebytes": 825, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/goa-account-google.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/goa-account-google.png", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "7242839ac8ed01d381d076fef12b6446e8c586e2", + "name": "ikiwiki/openid/goa-account-yahoo.png", + "uri": "", + "sizebytes": 741, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/goa-account-yahoo.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/goa-account-yahoo.png", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "4b08a31f68519ef1fbfb91df4f8b5e0f94ffbc3e", + "name": "ikiwiki/openid/index.html", + "uri": "", + "sizebytes": 2123, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/index.html", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "a926d52076cc7570f08f5c019f1a031359d39143", + "name": "ikiwiki/openid/livejournal.png", + "uri": "", + "sizebytes": 772, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/livejournal.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/livejournal.png", + "target": "manifest" + }, + { + "mimetype": "application/x-javascript", + "hash": "d5008d19c843def8a24dd42c50f7714fe127c7d5", + "name": "ikiwiki/openid/openid-jquery.js", + "uri": "", + "sizebytes": 7042, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/openid-jquery.js", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/openid-jquery.js", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "d73815d175d41f7e8f32d63671933a9b616203a2", + "name": "ikiwiki/openid/verisign.png", + "uri": "", + "sizebytes": 714, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/verisign.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/verisign.png", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "addc60ee0e8d7355232769d95d26fdd1e5f15ce3", + "name": "ikiwiki/openid/wordpress.png", + "uri": "", + "sizebytes": 886, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/wordpress.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/wordpress.png", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "d8f55af83af3aeed0961cd3d68500dd1ca6b6614", + "name": "ikiwiki/pagespec/attachment/index.html", + "uri": "", + "sizebytes": 2917, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/attachment/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/attachment/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "de5a703a667c47265ffa77bb685cf728cc56fb87", + "name": "ikiwiki/pagespec/index.html", + "uri": "", + "sizebytes": 6079, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "44b8439bc499f9f059e1b35fe7e42072d04dbaf9", + "name": "ikiwiki/pagespec/po/index.html", + "uri": "", + "sizebytes": 2156, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/po/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/po/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "978d9743e24419b68ea474db93ba09cb1ad00014", + "name": "ikiwiki/pagespec/sorting/index.html", + "uri": "", + "sizebytes": 2303, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/sorting/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/sorting/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "f4f91fe3f6f9151d6c64b0dd7e6a13030ef47046", + "name": "ikiwiki/searching/index.html", + "uri": "", + "sizebytes": 2095, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/searching/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/searching/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "9e29b6639d971bab8fc9164362f5d189a372abf3", + "name": "ikiwiki/subpage/index.html", + "uri": "", + "sizebytes": 2018, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/subpage/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/subpage/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "ff0698c45327ff98dc6be79e10de7d771620a34a", + "name": "ikiwiki/subpage/linkingrules/index.html", + "uri": "", + "sizebytes": 3110, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/subpage/linkingrules/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/subpage/linkingrules/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "a96dfbe3c51c7589d5eca6c664180e5f8b111a5f", + "name": "ikiwiki/wikilink/index.html", + "uri": "", + "sizebytes": 2779, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/wikilink/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|ikiwiki/wikilink/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "b7683c45f40bf214c0a63022ca70e2b18914651d", + "name": "index.html", + "uri": "CHK@Df82KVE2jZFntgB~bLWgSpZPqvbf1cyYZyHqWlwWryY,mJshNq8d-2L6J9yG0P3bJgU~6vBVeoxg-bZLbk1v~tU,AAMC--8/index.html", + "sizebytes": 1893, + "state": "changed", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|index.html", + "target": "manifest" + }, + { + "mimetype": "text/css", + "hash": "f4004ddc439b888f5e3fbd1d0b1986c93bc37f9d", + "name": "local.css", + "uri": "", + "sizebytes": 95, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/local.css", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|local.css", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "2cb5ded46fdf48786afda40e04c6a89ff0f7b58f", + "name": "recentchanges/index.html", + "uri": "", + "sizebytes": 1132, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/recentchanges/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|recentchanges/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "a63cc508643172235552675636c246b424b0ddf4", + "name": "sandbox/index.html", + "uri": "", + "sizebytes": 1788, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/sandbox/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|sandbox/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "f3f2194384014a027973dd2508b3248cefa73e47", + "name": "shortcuts/index.html", + "uri": "", + "sizebytes": 7337, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/shortcuts/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|shortcuts/index.html", + "target": "manifest" + }, + { + "mimetype": "text/css", + "hash": "572ba4ef870a29cbb4d89f65d45020a33ab6a08c", + "name": "style.css", + "uri": "", + "sizebytes": 9716, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/style.css", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|style.css", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "74854fda90d808ffef6542aa1be4f03d4924ffc7", + "name": "templates/index.html", + "uri": "", + "sizebytes": 5581, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/templates/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|templates/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "469975e8cf573e0bf02983ccb5f3863b1cbf79b6", + "name": "templates/note/index.html", + "uri": "", + "sizebytes": 1342, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/templates/note/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|templates/note/index.html", + "target": "manifest" + }, + { + "mimetype": "text/html", + "hash": "496bd9b6cea66621de88c628853ef566a1e85927", + "name": "templates/popup/index.html", + "uri": "", + "sizebytes": 1727, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/templates/popup/index.html", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|templates/popup/index.html", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "c89803ef14ddbb69e5ce1eff007d4bc668f92c14", + "name": "wikiicons/diff.png", + "uri": "", + "sizebytes": 219, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/diff.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|wikiicons/diff.png", + "target": "manifest" + }, + { + "mimetype": "image/gif", + "hash": "e9f3d29d52c3bbb0025384f1588851c52668da27", + "name": "wikiicons/openidlogin-bg.gif", + "uri": "", + "sizebytes": 336, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/openidlogin-bg.gif", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|wikiicons/openidlogin-bg.gif", + "target": "manifest" + }, + { + "mimetype": "image/png", + "hash": "aac65daad31ed2db63a79c810be74a5d61081f2e", + "name": "wikiicons/revert.png", + "uri": "", + "sizebytes": 397, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/revert.png", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|wikiicons/revert.png", + "target": "manifest" + }, + { + "mimetype": "image/gif", + "hash": "3431c95cd41474812f2a47b9ec31d11d5fbcd35c", + "name": "wikiicons/search-bg.gif", + "uri": "", + "sizebytes": 74, + "state": "idle", + "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/search-bg.gif", + "dda": true, + "id": "freesitemgr|Standing With Resilience Public|wikiicons/search-bg.gif", + "target": "manifest" + } +] + diff --git a/backend/freesitemgr/.config b/backend/freesitemgr/.config deleted file mode 100644 index 23242e6..0000000 --- a/backend/freesitemgr/.config +++ /dev/null @@ -1,7 +0,0 @@ -# freesitemgr configuration file -# managed by freesitemgr - edit with utmost care - -# FCP access details -fcpHost = '127.0.0.1' -fcpPort = 9481 - diff --git a/backend/freesitemgr/.gitignore b/backend/freesitemgr/.gitignore deleted file mode 100644 index 31d13b9..0000000 --- a/backend/freesitemgr/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Standing With Resilience diff --git a/backend/freesitemgr/Standing With Resilience Public b/backend/freesitemgr/Standing With Resilience Public deleted file mode 100644 index 92c4c7f..0000000 --- a/backend/freesitemgr/Standing With Resilience Public +++ /dev/null @@ -1,512 +0,0 @@ -# freesitemgr state file for freesite 'Standing With Resilience Public' -# managed by freesitemgr - edit only with the utmost care - -# general site config items - -name = "Standing With Resilience Public" -dir = "../html" -uriPriv = "USK@AKL0griFs7T25yw6-JR3Wk7vocvNBelOLg3RwtIL6aTp,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQECAAE/Standing With Resilience Public/5" -uriPub = "USK@hCLgfaINNSNAl4do-PapEincQP5Lxa72d8mFrzHqzqU,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQACAAE/Standing With Resilience Public/5/" -updateInProgress = True -insertingManifest = True -insertingIndex = False -index = "index.html" -sitemap = "sitemap.html" -mtype = "text/html" - -# Detailed site contents -files = [ - { - "mimetype": "text/html", - "hash": "5cdfef47f51c5342ac4ad6f40750ce68073feac7", - "name": "Freenet/index.html", - "uri": "", - "sizebytes": 2528, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Freenet/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|Freenet/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "2e95c9e421f2f02724d7dc1b11a79bcd9dc6553a", - "name": "Shielding/index.html", - "uri": "", - "sizebytes": 6115, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Shielding/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|Shielding/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "787ae2089bf98addf7bae3bfda86adb0f5fc5c20", - "name": "TODO/index.html", - "uri": "", - "sizebytes": 1385, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/TODO/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|TODO/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "bc4c198b805f15403fe4680f768942e578952552", - "name": "Tech_Savvy/index.html", - "uri": "", - "sizebytes": 1351, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Tech_Savvy/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|Tech_Savvy/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "4f430ff6ba065b308eedd854e68202d39e6b4cce", - "name": "Technical_Resources/index.html", - "uri": "", - "sizebytes": 1301, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/Technical_Resources/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|Technical_Resources/index.html", - "target": "manifest" - }, - { - "mimetype": "image/x-icon", - "hash": "8d06e9596fe48d7afd629fb4dca33f77deaa3454", - "name": "favicon.ico", - "uri": "", - "sizebytes": 371, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/favicon.ico", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|favicon.ico", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "a52f263074f721782dd4f156ba60476cecdaf15e", - "name": "ikiwiki/directive/index.html", - "uri": "", - "sizebytes": 3290, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/directive/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/directive/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "1dee7e4fe7fb96e78b5d29dd5ab0e6007b3e0f14", - "name": "ikiwiki/formatting/index.html", - "uri": "", - "sizebytes": 3539, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/formatting/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/formatting/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "f4d034a4e642fe5052f05b82ba43e0e160db305e", - "name": "ikiwiki/index.html", - "uri": "", - "sizebytes": 1707, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/index.html", - "target": "manifest" - }, - { - "mimetype": "application/x-javascript", - "hash": "cb5af1fc93aa1ca43f48712a29b804c62022daa6", - "name": "ikiwiki/jquery.min.js", - "uri": "", - "sizebytes": 101525, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/jquery.min.js", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/jquery.min.js", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "3f77190fadf80f13b41698b127c4a78cdc9cc1d4", - "name": "ikiwiki/markdown/index.html", - "uri": "", - "sizebytes": 1841, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/markdown/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/markdown/index.html", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "4a2f38c17e72fa05328b4221385f070878f5a8a4", - "name": "ikiwiki/openid/aol.png", - "uri": "", - "sizebytes": 460, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/aol.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/aol.png", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "2569b6eff0969180a0c2c8b7403f1acb400028b7", - "name": "ikiwiki/openid/goa-account-flickr.png", - "uri": "", - "sizebytes": 592, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/goa-account-flickr.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/goa-account-flickr.png", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "ca326227916ee2305acfa66a77b5fb18288b09f8", - "name": "ikiwiki/openid/goa-account-google.png", - "uri": "", - "sizebytes": 825, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/goa-account-google.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/goa-account-google.png", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "7242839ac8ed01d381d076fef12b6446e8c586e2", - "name": "ikiwiki/openid/goa-account-yahoo.png", - "uri": "", - "sizebytes": 741, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/goa-account-yahoo.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/goa-account-yahoo.png", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "4b08a31f68519ef1fbfb91df4f8b5e0f94ffbc3e", - "name": "ikiwiki/openid/index.html", - "uri": "", - "sizebytes": 2123, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/index.html", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "a926d52076cc7570f08f5c019f1a031359d39143", - "name": "ikiwiki/openid/livejournal.png", - "uri": "", - "sizebytes": 772, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/livejournal.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/livejournal.png", - "target": "manifest" - }, - { - "mimetype": "application/x-javascript", - "hash": "d5008d19c843def8a24dd42c50f7714fe127c7d5", - "name": "ikiwiki/openid/openid-jquery.js", - "uri": "", - "sizebytes": 7042, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/openid-jquery.js", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/openid-jquery.js", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "d73815d175d41f7e8f32d63671933a9b616203a2", - "name": "ikiwiki/openid/verisign.png", - "uri": "", - "sizebytes": 714, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/verisign.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/verisign.png", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "addc60ee0e8d7355232769d95d26fdd1e5f15ce3", - "name": "ikiwiki/openid/wordpress.png", - "uri": "", - "sizebytes": 886, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/openid/wordpress.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/openid/wordpress.png", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "d8f55af83af3aeed0961cd3d68500dd1ca6b6614", - "name": "ikiwiki/pagespec/attachment/index.html", - "uri": "", - "sizebytes": 2917, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/attachment/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/attachment/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "de5a703a667c47265ffa77bb685cf728cc56fb87", - "name": "ikiwiki/pagespec/index.html", - "uri": "", - "sizebytes": 6079, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "44b8439bc499f9f059e1b35fe7e42072d04dbaf9", - "name": "ikiwiki/pagespec/po/index.html", - "uri": "", - "sizebytes": 2156, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/po/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/po/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "978d9743e24419b68ea474db93ba09cb1ad00014", - "name": "ikiwiki/pagespec/sorting/index.html", - "uri": "", - "sizebytes": 2303, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/pagespec/sorting/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/pagespec/sorting/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "f4f91fe3f6f9151d6c64b0dd7e6a13030ef47046", - "name": "ikiwiki/searching/index.html", - "uri": "", - "sizebytes": 2095, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/searching/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/searching/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "9e29b6639d971bab8fc9164362f5d189a372abf3", - "name": "ikiwiki/subpage/index.html", - "uri": "", - "sizebytes": 2018, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/subpage/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/subpage/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "ff0698c45327ff98dc6be79e10de7d771620a34a", - "name": "ikiwiki/subpage/linkingrules/index.html", - "uri": "", - "sizebytes": 3110, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/subpage/linkingrules/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/subpage/linkingrules/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "a96dfbe3c51c7589d5eca6c664180e5f8b111a5f", - "name": "ikiwiki/wikilink/index.html", - "uri": "", - "sizebytes": 2779, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/ikiwiki/wikilink/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|ikiwiki/wikilink/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "049b8e88e0037e2daee08f01ee7739f909dca955", - "name": "index.html", - "uri": "CHK@Df82KVE2jZFntgB~bLWgSpZPqvbf1cyYZyHqWlwWryY,mJshNq8d-2L6J9yG0P3bJgU~6vBVeoxg-bZLbk1v~tU,AAMC--8/index.html", - "sizebytes": 1817, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|index.html", - "target": "manifest" - }, - { - "mimetype": "text/css", - "hash": "f4004ddc439b888f5e3fbd1d0b1986c93bc37f9d", - "name": "local.css", - "uri": "", - "sizebytes": 95, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/local.css", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|local.css", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "2cb5ded46fdf48786afda40e04c6a89ff0f7b58f", - "name": "recentchanges/index.html", - "uri": "", - "sizebytes": 1132, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/recentchanges/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|recentchanges/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "a63cc508643172235552675636c246b424b0ddf4", - "name": "sandbox/index.html", - "uri": "", - "sizebytes": 1788, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/sandbox/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|sandbox/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "f3f2194384014a027973dd2508b3248cefa73e47", - "name": "shortcuts/index.html", - "uri": "", - "sizebytes": 7337, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/shortcuts/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|shortcuts/index.html", - "target": "manifest" - }, - { - "mimetype": "text/css", - "hash": "572ba4ef870a29cbb4d89f65d45020a33ab6a08c", - "name": "style.css", - "uri": "", - "sizebytes": 9716, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/style.css", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|style.css", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "74854fda90d808ffef6542aa1be4f03d4924ffc7", - "name": "templates/index.html", - "uri": "", - "sizebytes": 5581, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/templates/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|templates/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "469975e8cf573e0bf02983ccb5f3863b1cbf79b6", - "name": "templates/note/index.html", - "uri": "", - "sizebytes": 1342, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/templates/note/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|templates/note/index.html", - "target": "manifest" - }, - { - "mimetype": "text/html", - "hash": "496bd9b6cea66621de88c628853ef566a1e85927", - "name": "templates/popup/index.html", - "uri": "", - "sizebytes": 1727, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/templates/popup/index.html", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|templates/popup/index.html", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "c89803ef14ddbb69e5ce1eff007d4bc668f92c14", - "name": "wikiicons/diff.png", - "uri": "", - "sizebytes": 219, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/diff.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|wikiicons/diff.png", - "target": "manifest" - }, - { - "mimetype": "image/gif", - "hash": "e9f3d29d52c3bbb0025384f1588851c52668da27", - "name": "wikiicons/openidlogin-bg.gif", - "uri": "", - "sizebytes": 336, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/openidlogin-bg.gif", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|wikiicons/openidlogin-bg.gif", - "target": "manifest" - }, - { - "mimetype": "image/png", - "hash": "aac65daad31ed2db63a79c810be74a5d61081f2e", - "name": "wikiicons/revert.png", - "uri": "", - "sizebytes": 397, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/revert.png", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|wikiicons/revert.png", - "target": "manifest" - }, - { - "mimetype": "image/gif", - "hash": "3431c95cd41474812f2a47b9ec31d11d5fbcd35c", - "name": "wikiicons/search-bg.gif", - "uri": "", - "sizebytes": 74, - "state": "idle", - "path": "/home/gentoo/src/standingwithresilience.branchable.com/html/wikiicons/search-bg.gif", - "dda": true, - "id": "freesitemgr|Standing With Resilience Public|wikiicons/search-bg.gif", - "target": "manifest" - } -] - diff --git a/backend/resilient/__init__.py b/backend/resilient/__init__.py new file mode 100644 index 0000000..490ff3f --- /dev/null +++ b/backend/resilient/__init__.py @@ -0,0 +1,107 @@ +import os, urllib + +__all__ = ["freenet"] + +name = 'A Wiki for Targeted Individuals' + +backend_path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) + +auth_path = os.path.join(backend_path, 'auth') +html_path = os.path.normpath(os.path.join(backend_path, '../html')) +wiki_src_path = os.path.normpath(os.path.join(backend_path, '../wiki')) +git_path = os.path.normpath(os.path.join(backend_path, '../.git')) + + +ssh_config_path = os.path.join(auth_path, "ssh-config") + +def url200(url): + try: + return urllib.urlopen(url).getcode() == 200 + except IOError: + return False + +class git: + found = (os.system("git status --porcelain") == 0) + if not found: + print("ERROR: git not found") + exit(1) + + def __init__(self, remote, push_remote = None): + self.remote = remote + if push_remote == None: + push_remote = remote + self.push_remote = push_remote + + def pull(self): + if self.remote == None: + return False + os.environ["GIT_SSH_COMMAND"] = "ssh -F %s" % ssh_config_path + status = os.system("git pull %s master" % self.remote) + del os.environ["GIT_SSH_COMMAND"] + return status == 0 + + def push(self): + if self.push_remote == None: + return False + os.environ["GIT_SSH_COMMAND"] = "ssh -F %s" % ssh_config_path + status = os.system("git push %s master" % self.push_remote) + del os.environ["GIT_SSH_COMMAND"] + return status == 0 + + +class ikiwiki: + found = (os.system("ikiwiki --version") == 0) + if not found: + print("WARNING: ikiwiki not found, pages will not be built") + + synced = False + + def push(self): + if not ikiwiki.found: + return False + + if ikiwiki.synced: + return True + + html_git_path = os.path.join(html_path, '.git') + os.system("rm -rf '%s'" % html_path) + os.system("mkdir -p '%s'" % html_git_path) + + status = os.system("ikiwiki --wikiname '%s' --rebuild '%s' '%s'" % (name.replace("'","'\"'\"'"), wiki_src_path, html_path)) + + ikiwiki.synced = status == 0 + if ikiwiki.synced: + os.system('git gc') + os.system('git update-server-info') + for path in ['objects', 'refs', 'HEAD', 'info', 'packed-refs']: + os.system("cp -r '%s' '%s'" % (os.path.join(git_path, path), html_git_path)) + return ikiwiki.synced + + +class zeronet(): + running = url200('http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D') + if not running: + print("WARNING: ZeroNet not running, won't be used") + + found = 'ZERONETDIR' in os.environ + if found: + zn_datadir = os.path.join(os.environ['ZERONETDIR'], 'ZeroNet/data') + zn_script = os.path.join(os.environ['ZERONETDIR'], 'ZeroNet.sh') + found = (os.system("'%s' --version" % zn_script) == 0) + if not found: + print("WARNING: ZeroNet bundle not found in ZERONETDIR, public zeronet site won't be updated") + + def __init__(self, addr, key): + self.addr = addr + self.key = key + + def push(self): + if not ikiwiki.synced: + return False + zitedir = os.path.join(zeronet.zn_datadir, self.addr) + status = os.system('cp -r %s %s' % (os.path.join(html_path, '.'), os.path.join(zitedir, '.'))) + if status != 0: + return False + status = os.system('%s siteSign %s %s' % (zeronet.zn_script, self.addr, self.key)) + return status == 0 + diff --git a/backend/resilient/freenet.py b/backend/resilient/freenet.py new file mode 100644 index 0000000..ea72760 --- /dev/null +++ b/backend/resilient/freenet.py @@ -0,0 +1,30 @@ +from resilient import auth_path, git, ikiwiki, url200 +import os + +running = url200('http://127.0.0.1:8888/') +if not running: + print("WARNING: freenet not running, changes won't be synced with freenet") + +class gitocalypse(git): + found = (os.system("git-remote-freenet") == 256) + if not found: + print("WARNING: gitocalypse not found, changes won't be synced with freenet") + + def __init__(self, pull_remote, push_remote = None): + self.remote = pull_remote + self.push_remote = push_remote + +class freesitemgr(): + found = (os.system("freesitemgr --version") == 0) + if not found: + print("WARNING: freesitemgr/pyFreenet not found, public freesite won't be updated") + + def __init__(self): + pass + + def push(self): + if not ikiwiki.synced: + return False + config_path = os.path.join(auth_path, 'freesitemgr') + status = os.system("freesitemgr -c '%s' -v -r 1 update" % config_path) + return status == 0 diff --git a/backend/update.py b/backend/update.py index ebf82bf..47b05c4 100755 --- a/backend/update.py +++ b/backend/update.py @@ -1,128 +1,80 @@ #!/usr/bin/env python2 -import os -import sys +import resilient +import resilient.freenet -############### Enumerate dependencies +##################### Instantiate remotes -found_git = (os.system("git status --porcelain") == 0) +git_repos = [ + resilient.git('git://standingwithresilience.branchable.com/'), + resilient.git('fairlystable-guest:/srv/git/standingwithresilience') +] -if not found_git: - print("ERROR: git not found") - exit(1) +if resilient.freenet.gitocalypse.found and resilient.freenet.running: + git_repos.extend([ + #### public freenet #### + resilient.freenet.gitocalypse('freenet://USK@hCLgfaINNSNAl4do-PapEincQP5Lxa72d8mFrzHqzqU,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQACAAE/Standing%20With%20Resilience%20Public.git.R1/0', 'freenet://USK@AKL0griFs7T25yw6-JR3Wk7vocvNBelOLg3RwtIL6aTp,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQECAAE/Standing%20With%20Resilience%20Public.git.R1/0'), + #### private freenet #### + resilient.freenet.gitocalypse('freenet://USK@PSY0YngeDtGbj60hjEoilQiY9oKzVrptRC0rG4BEVPg,e6ZEjT4KvbsltPBJOeKNpIdty2oGzbLCdk4fsDA5Vdk,AQACAAE/Standing%20With%20Resilience.git.R1/0') + ]) -found_ikiwiki = (os.system("ikiwiki --version") == 0) -found_gitocalypse = (os.system("git-remote-freenet") == 256) -found_freesitemgr = (os.system("freesitemgr --version") == 0) -found_zeronet = 'ZERONETDIR' in os.environ -if found_zeronet: - zn_datadir = os.path.join(os.environ['ZERONETDIR'], 'ZeroNet/data') - zn_script = os.path.join(os.environ['ZERONETDIR'], 'ZeroNet.sh') - found_zeronet = (os.system("'%s' --version" % zn_script) == 0) - -if not found_ikiwiki: - print("WARNING: ikiwiki not found, pages will not be built") -if not found_gitocalypse: - print("WARNING: gitocalypse not found, changes won't be synced with freenet") -if not found_freesitemgr: - print("WARNING: freesitemgr/pyFreenet not found, public freesite won't be updated") -if not found_zeronet: - print("WARNING: ZeroNet not found in ZERONETDIR, public zeronet site won't be updated") - -if not (found_ikiwiki or found_gitocalypse or found_freesitemgr): - print("Changes will still be propagated if branchable is working.") +zeronet_urls = ['http://bit.no.com:43110'] +if resilient.zeronet.running: + zeronet_urls.append('http://127.0.0.1:43110') +for host in zeronet_urls: + git_repos.extend([ + #### public zeronet #### + resilient.git('%s/1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4/.git' % host), + #### private zeronet #### + resilient.git('%s/1L363bqJnCG63SnV83kfV7izZXbmentctD/.git' % host) + ]) ####################### Download from all -print(":: Pulling from simple repos ...") -os.environ["GIT_SSH_COMMAND"] = "ssh -F backend/auth/ssh-config" - -status = 0 -status += os.system("git pull git://standingwithresilience.branchable.com/ master") - -if status != 0: - print("WARNING: failed to pull changes from branchable") - #exit(status) - -status += os.system("git pull fairlystable-guest:/srv/git/standingwithresilience master") +print(":: Pulling from git repos ...") -if status != 0: - print("WARNING: failed to pull changes from fairlystable") - #exit(status) +for repo in git_repos: + repo.pull() -del os.environ["GIT_SSH_COMMAND"] +########################### Upload to all +print(":: Pushing to git repos ...") -# Pull from zeronet repos -print(":: Pulling from zeronet repos ...") -# public zeronet -os.system("git pull http://127.0.0.1:43110/1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4/.git master") -# private zeronet -os.system("git pull http://127.0.0.1:43110/1L363bqJnCG63SnV83kfV7izZXbmentctD/.git master") +for repo in git_repos: + repo.push() -# Pull from freenet repos -if found_gitocalypse: - print(":: Pulling from freenet repos ...") - # public freenet - os.system("git pull freenet://USK@hCLgfaINNSNAl4do-PapEincQP5Lxa72d8mFrzHqzqU,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQACAAE/Standing%20With%20Resilience%20Public.git.R1/0 master") - # private freenet - os.system("git pull freenet://USK@PSY0YngeDtGbj60hjEoilQiY9oKzVrptRC0rG4BEVPg,e6ZEjT4KvbsltPBJOeKNpIdty2oGzbLCdk4fsDA5Vdk,AQACAAE/Standing%20With%20Resilience.git.R1/0 master") +############################## Build wiki +if not resilient.ikiwiki.found: + print (":: Not building wiki; missing ikiwiki") + exit(0) +print (":: Building wiki ...") -######################### Upload to all - -print(":: Pushing to simple repos ...") -os.environ["GIT_SSH_COMMAND"] = "ssh -F backend/auth/ssh-config" - -status += os.system("git push git://standingwithresilience.branchable.com/") -status += os.system("git push fairlystable-guest:/srv/git/standingwithresilience") - -del os.environ["GIT_SSH_COMMAND"] - +if not resilient.ikiwiki().push(): + print (":: Exiting due to failure") + exit(-1) -# Push to freenet repos -if found_gitocalypse: - print (":: Pushing to freenet repos ...") - # public freenet - os.system("git push freenet://USK@AKL0griFs7T25yw6-JR3Wk7vocvNBelOLg3RwtIL6aTp,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQECAAE/Standing%20With%20Resilience%20Public.git.R1/0") +####################### Instantiate hosts +hosts = [] -# Build wiki +if resilient.zeronet.found: + hosts.append(resilient.zeronet('1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4', '5JzZACCELsT4bx66qmV9JDaWhEQ6Sx6j7LzeucsxJGA9H7nuoRr')) -if status != 0: - print (":: Exiting due to failure") - exit(status) +if resilient.freenet.freesitemgr.found and resilient.freenet.running: + hosts.append(resilient.freenet.freesitemgr()) # keys for freesitemgr are in auth/freesitemgr -if not found_ikiwiki: - print (":: Not building wiki; missing ikiwiki") - exit(0) +########################### Upload to all -print (":: Building wiki ...") +print (":: Publishing site ...") -status += os.system("ikiwiki --wikiname 'A Wiki for Targeted Individuals' --rebuild ../wiki ../html") +for host in hosts: + host.push() -if status != 0: - print (":: Exiting due to failure") - exit(status) - -if found_zeronet: - os.system('git update-server-info') - print (":: Publishing ZeroNet site ...") - zn_datadir = os.path.join(zn_datadir, '1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4') - os.system('cp -r ../html/. %s/.' % zn_datadir) - os.system('mkdir -p %s/.git' % zn_datadir) - for file in ('objects', 'refs', 'HEAD', 'info', 'packed-refs'): - os.system('cp -a ../.git/%s %s/.git' % (file, zn_datadir)) - os.system('%s siteSign 1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4 5JzZACCELsT4bx66qmV9JDaWhEQ6Sx6j7LzeucsxJGA9H7nuoRr' % zn_script) - -if found_freesitemgr: - print (":: Publishing freesite ...") - status += os.system("freesitemgr -c freesitemgr -v -l freesitemgr.log -r 1 update") +######################################### print "Done." - -exit(status) -- cgit v1.2.3