Пример #1
0
func (c BundleControllerWithValidation) GetDownloadBundle(bundleId int) revel.Result {
	bundle := c.Bundle

	plistUrl, err := c.UriFor(fmt.Sprintf("bundle/%d/download_plist", bundle.Id))
	if err != nil {
		panic(err)
	}

	signatureInfo := models.NewLimitedTimeSignatureInfo(plistUrl.Host, plistUrl.Path)
	signatureInfo.RefreshSignature(Conf.Secret)

	plistUrl.RawQuery = signatureInfo.UrlValues().Encode()

	return c.Render(plistUrl)
}
Пример #2
0
func (c *LimitedTimeController) GetDownloadPlist(bundleId int) revel.Result {
	bundle := c.Bundle

	ipaUrl, err := c.UriFor(fmt.Sprintf("bundle/%d/download_ipa", bundle.Id))
	if err != nil {
		panic(err)
	}

	signatureInfo := models.NewLimitedTimeSignatureInfo(ipaUrl.Host, ipaUrl.Path)
	signatureInfo.RefreshSignature(Conf.Secret)

	ipaUrl.RawQuery = signatureInfo.UrlValues().Encode()

	r, err := bundle.PlistReader(Dbm, ipaUrl)
	if err != nil {
		panic(err)
	}

	c.Response.ContentType = "application/x-plist"
	return c.RenderBinary(r, models.PlistFileName, revel.Attachment, time.Now())
}