How to use the fcp.sitemgr.fixUri function in fcp

To help you get started, we’ve selected a few fcp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freenet / pyFreenet / freesitemgr.py View on Github external
uriPriv = raw_input("Site private URI (if any - press ENTER for new\n: ").strip()
        if not uriPriv:
            uriPub, uriPriv = sitemgr.node.genkey()
        else:
            if not fcp.node.uriIsPrivate(uriPriv):
                print "Sorry, that's a public URI, we need a private URI"
                continue
            try:
                uriPub = sitemgr.node.invertprivate(uriPriv)
            except:
                traceback.print_exc()
                print "Invalid private URI:\n  %s" % uriPriv
                continue
        break
        uriPub = fixUri(uriPub, sitename)
        uriPriv = fixUri(uriPriv, sitename)
    
    # good to go - add the site
    sitemgr.addSite(name=sitename, dir=sitedir, uriPub=uriPub, uriPriv=uriPriv)

    print "Added new freesite: '%s' => %s" % (sitename, sitedir)
github freenet / pyFreenet / freesitemgr.py View on Github external
while 1:
        uriPriv = raw_input("Site private URI (if any - press ENTER for new\n: ").strip()
        if not uriPriv:
            uriPub, uriPriv = sitemgr.node.genkey()
        else:
            if not fcp.node.uriIsPrivate(uriPriv):
                print "Sorry, that's a public URI, we need a private URI"
                continue
            try:
                uriPub = sitemgr.node.invertprivate(uriPriv)
            except:
                traceback.print_exc()
                print "Invalid private URI:\n  %s" % uriPriv
                continue
        break
        uriPub = fixUri(uriPub, sitename)
        uriPriv = fixUri(uriPriv, sitename)
    
    # good to go - add the site
    sitemgr.addSite(name=sitename, dir=sitedir, uriPub=uriPub, uriPriv=uriPriv)

    print "Added new freesite: '%s' => %s" % (sitename, sitedir)