Ejemplo n.º 1
0
    def render_GET(self, request):
        request.setHeader('Content-Type', 'application/rss+xml')
        macdb = DbHelper()
        items = macdb.fetch_several_latest(5)

        output = """<?xml version="1.0" encoding="utf-8"?>
    <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
       <channel>
          <title>BitPop Update Feed</title>
          <link>"""
        output += Config.insecureDomain + self.pathFromRoot
        output += """</link>
          <description>List of BitPop packages with different versions.</description>
          <language>en</language>"""

        if len(items) > 0:
            for item in items:
                output += """
             <item>
                <title>Version {0}</title>
                <description><![CDATA[
                  {1}
                ]]></description>
                <pubDate>{2}</pubDate>
                <enclosure url="{3}" sparkle:version="{0}" length="{4}" type="application/octet-stream" sparkle:dsaSignature="{5}" />
             </item>""".format(
                    item['version'], item['rel_notes'],
                    strftime(
                        "%a, %d %b %Y %H:%M:%S +0000",
                        datetime.utcfromtimestamp(item['pub_ts']).timetuple()),
                    getUpdateURLMac('BitPop-' + item['version'] + '.dmg'),
                    item['dmg_size'], item['dsa_signature'])
        output += """
       </channel>
    </rss>
"""

        macdb.cleanup()

        return output
Ejemplo n.º 2
0
  def render_GET(self, request):
    request.setHeader('Content-Type', 'application/rss+xml')
    macdb = DbHelper()
    items = macdb.fetch_several_latest(5)
    
    output = """<?xml version="1.0" encoding="utf-8"?>
    <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
       <channel>
          <title>BitPop Update Feed</title>
          <link>"""
    output += Config.insecureDomain + self.pathFromRoot
    output += """</link>
          <description>List of BitPop packages with different versions.</description>
          <language>en</language>"""
    
    if len(items) > 0:
      for item in items:
        output += """
             <item>
                <title>Version {0}</title>
                <description><![CDATA[
                  {1}
                ]]></description>
                <pubDate>{2}</pubDate>
                <enclosure url="{3}" sparkle:version="{0}" length="{4}" type="application/octet-stream" sparkle:dsaSignature="{5}" />
             </item>""".format(item['version'], item['rel_notes'], 
                               strftime("%a, %d %b %Y %H:%M:%S +0000", 
                                  datetime.utcfromtimestamp(item['pub_ts']).timetuple()), 
                               getUpdateURLMac('BitPop-' + item['version'] + '.dmg'),
                               item['dmg_size'], item['dsa_signature'])
    output += """
       </channel>
    </rss>
"""
    
    macdb.cleanup()
    
    return output
Ejemplo n.º 3
0
    def render_GET(self, request):
        macdb = DbHelper()
        
        mainDict = loadJsonAndCheckIfLatestKeyExists(Config.bitpopUpdateInfoFile)
        bitpopInfo = mainDict['jsonData']
        latestExists = mainDict['latestExists']

        output = """<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">

    <title>House of Life Update Manager</title>

    <!-- CSS: implied media="all" -->
    <link rel="stylesheet" href="/css/style.css?v=2">
</head>
<body>
    <div id="container">
        <header>
            <h1>House of Life Update Manager</h1>
            <p>Copyright &copy; 2011, House of Life Property ltd. All rights reserved.<br />
               Copyright &copy; 2011, Crystalnix &lt;[email protected]&gt;</p>
        </header>
        <div id="main" role="main">
          <section id="win_updates">"""

        output += """
            <h2>BitPop <img src="/img/windows-logo.png" alt="Windows logo" /></h2>"""
        if not latestExists:
            output += """
            <p>There are no BitPop Windows updates available.</p>"""
        else:
            output += """
            <p>Latest BitPop version: {0}</p>""".format(bitpopInfo["latest"])
            output += """
            <h3>Update files</h3>
            <ul>
                <li><a href="{0}">full update v{1}</a></li>""".format(getUpdateURL(bitpopInfo['latest']),
                                                                      bitpopInfo['latest'])
            if bitpopInfo.has_key('delta') and type(bitpopInfo['delta']) == type([]):
                for deltaFromVersion in bitpopInfo['delta']:
                    output += """
                <li><a href="{0}">delta update from v{1}</a></li>""".format(
                        getUpdateURL(bitpopInfo['latest'], deltaFromVersion),
                        deltaFromVersion)
        output += """
            </ul>"""

        bitpopNewDict = loadJsonAndCheckIfLatestKeyExists(Config.bitpopNewUpdateInfoFile)
        bitpopNewInfo = bitpopNewDict['jsonData']
        bitpopNewLatestExists = bitpopNewDict['latestExists']

        if not bitpopNewLatestExists:
            output += """
            <p><a href="{0}">Add new full version installer</a></p>""".format(self.pathFromRoot + '/new_full')
        else:
            output += """
            <h3>Uploaded new version {0}</h3>""".format(bitpopNewInfo['latest'])
            if bitpopNewInfo.has_key('delta') and type(bitpopNewInfo['delta']) == type([]):
                output += """
                <ul>"""
                for newDeltaFrom in bitpopNewInfo['delta']:
                    output += """
                    <li>delta from {0}</li>""".format(newDeltaFrom)
                output += """
                </ul>"""
            output += """
            <p><a href="{0}">Add new delta update installer</a></p>
            <p><a href="{1}">Switch to new version ({2})</a></p>""".format(
                self.pathFromRoot + '/new_delta', self.pathFromRoot + '/switch', bitpopNewInfo['latest'])
        output += """
            <p>
                <form style="display:none" id="clear_all" method="POST">
                  <input type="hidden" name="action" value="delete" />
                </form>
                <a href="javascript:void(0)" onclick="(function () { document.getElementById('clear_all').submit();})()">
                   Clear all updates
                </a>
            </p>
          </section>
          <section id="mac_updates">
            <h2>BitPop <img src="/img/apple-logo.png" alt="Apple logo" /></h2>"""

        macUpdates = macdb.fetch_several_latest(5)
        if len(macUpdates) != 0:
          output += """
            <p>Latest BitPop version: {0}</p>""".format(macUpdates[0]["version"])
          output += """
            <h3>Update files:</h3>
            <ul>"""
          
          activeVersion = None
          try:
            activeStream = open(Config.macActiveVersionFile, "r")
            try:
              activeVersion = activeStream.readline()
            finally:
              activeStream.close()
          except IOError:
            pass
          
          for upd in macUpdates:
            output += """
              <li><a href="{0}">full update v{1}{2}</a>""".format(getUpdateURLMac(upd['dmg_path']),
                                                                  upd['version'],
                                                                  ' (*)' if upd['version'] == activeVersion 
                                                                         else ''
                                                                 )
            output += """
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <a href="/service/admin/mac/edit/{0}">Edit</a> |
                  <a href="/service/admin/mac/delete/{0}"
                    onclick="javascript: return confirm('Are you sure you want to delete this version?');">
                      Delete
                  </a>""".format(upd['id'])
          output += """
            </ul>"""
#          if macUpdates[0]['version'] != activeVersion:
#            output += """
#            <p><a href="{0}">Make latest version active
        else:
          output += """
            <p>There are no BitPop mac updates available.</p>"""

        output += """            
            <p><a href="{0}">Add new version archive</a></p>""".format(self.pathFromRoot + '/mac/new_full')
        output += """
          </section>
        </div>
        <footer>
        </footer>
    </div>
</body>
</html>"""
        macdb.cleanup()
        return output
Ejemplo n.º 4
0
    def render_GET(self, request):
        macdb = DbHelper()

        mainDict = loadJsonAndCheckIfLatestKeyExists(
            Config.bitpopUpdateInfoFile)
        bitpopInfo = mainDict['jsonData']
        latestExists = mainDict['latestExists']

        output = """<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">

    <title>House of Life Update Manager</title>

    <!-- CSS: implied media="all" -->
    <link rel="stylesheet" href="/css/style.css?v=2">
</head>
<body>
    <div id="container">
        <header>
            <h1>House of Life Update Manager</h1>
            <p>Copyright &copy; 2011, House of Life Property ltd. All rights reserved.<br />
               Copyright &copy; 2011, Crystalnix &lt;[email protected]&gt;</p>
        </header>
        <div id="main" role="main">
          <section id="win_updates">"""

        output += """
            <h2>BitPop <img src="/img/windows-logo.png" alt="Windows logo" /></h2>"""
        if not latestExists:
            output += """
            <p>There are no BitPop Windows updates available.</p>"""
        else:
            output += """
            <p>Latest BitPop version: {0}</p>""".format(bitpopInfo["latest"])
            output += """
            <h3>Update files</h3>
            <ul>
                <li><a href="{0}">full update v{1}</a></li>""".format(
                getUpdateURL(bitpopInfo['latest']), bitpopInfo['latest'])
            if bitpopInfo.has_key('delta') and type(
                    bitpopInfo['delta']) == type([]):
                for deltaFromVersion in bitpopInfo['delta']:
                    output += """
                <li><a href="{0}">delta update from v{1}</a></li>""".format(
                        getUpdateURL(bitpopInfo['latest'], deltaFromVersion),
                        deltaFromVersion)
        output += """
            </ul>"""

        bitpopNewDict = loadJsonAndCheckIfLatestKeyExists(
            Config.bitpopNewUpdateInfoFile)
        bitpopNewInfo = bitpopNewDict['jsonData']
        bitpopNewLatestExists = bitpopNewDict['latestExists']

        if not bitpopNewLatestExists:
            output += """
            <p><a href="{0}">Add new full version installer</a></p>""".format(
                self.pathFromRoot + '/new_full')
        else:
            output += """
            <h3>Uploaded new version {0}</h3>""".format(
                bitpopNewInfo['latest'])
            if bitpopNewInfo.has_key('delta') and type(
                    bitpopNewInfo['delta']) == type([]):
                output += """
                <ul>"""
                for newDeltaFrom in bitpopNewInfo['delta']:
                    output += """
                    <li>delta from {0}</li>""".format(newDeltaFrom)
                output += """
                </ul>"""
            output += """
            <p><a href="{0}">Add new delta update installer</a></p>
            <p><a href="{1}">Switch to new version ({2})</a></p>""".format(
                self.pathFromRoot + '/new_delta',
                self.pathFromRoot + '/switch', bitpopNewInfo['latest'])
        output += """
            <p>
                <form style="display:none" id="clear_all" method="POST">
                  <input type="hidden" name="action" value="delete" />
                </form>
                <a href="javascript:void(0)" onclick="(function () { document.getElementById('clear_all').submit();})()">
                   Clear all updates
                </a>
            </p>
          </section>
          <section id="mac_updates">
            <h2>BitPop <img src="/img/apple-logo.png" alt="Apple logo" /></h2>"""

        macUpdates = macdb.fetch_several_latest(5)
        if len(macUpdates) != 0:
            output += """
            <p>Latest BitPop version: {0}</p>""".format(
                macUpdates[0]["version"])
            output += """
            <h3>Update files:</h3>
            <ul>"""

            activeVersion = None
            try:
                activeStream = open(Config.macActiveVersionFile, "r")
                try:
                    activeVersion = activeStream.readline()
                finally:
                    activeStream.close()
            except IOError:
                pass

            for upd in macUpdates:
                output += """
              <li><a href="{0}">full update v{1}{2}</a>""".format(
                    getUpdateURLMac(upd['dmg_path']), upd['version'],
                    ' (*)' if upd['version'] == activeVersion else '')
                output += """
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <a href="/service/admin/mac/edit/{0}">Edit</a> |
                  <a href="/service/admin/mac/delete/{0}"
                    onclick="javascript: return confirm('Are you sure you want to delete this version?');">
                      Delete
                  </a>""".format(upd['id'])
            output += """
            </ul>"""
#          if macUpdates[0]['version'] != activeVersion:
#            output += """
#            <p><a href="{0}">Make latest version active
        else:
            output += """
            <p>There are no BitPop mac updates available.</p>"""

        output += """            
            <p><a href="{0}">Add new version archive</a></p>""".format(
            self.pathFromRoot + '/mac/new_full')
        output += """
          </section>
        </div>
        <footer>
        </footer>
    </div>
</body>
</html>"""
        macdb.cleanup()
        return output