picasa: work on making the instructions accurate & work

This commit is contained in:
Brad Fitzpatrick 2014-07-25 13:37:47 -07:00
parent fad3a60a77
commit 8af06fa3ff
1 changed files with 12 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import (
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"net/url"
"path/filepath" "path/filepath"
"strings" "strings"
@ -89,12 +90,19 @@ func newImporter() *imp {
} }
func (im imp) AccountSetupHTML(host *importer.Host) string { func (im imp) AccountSetupHTML(host *importer.Host) string {
base := host.ImporterBaseURL() + "picasa" // Picasa doens't allow a path in the origin. Remove it.
origin := host.ImporterBaseURL()
if u, err := url.Parse(origin); err == nil {
u.Path = ""
origin = u.String()
}
callback := host.ImporterBaseURL() + "picasa/callback"
return fmt.Sprintf(` return fmt.Sprintf(`
<h1>Configuring Picasa</h1> <h1>Configuring Picasa</h1>
<p>Visit <a href='https://console.developers.google.com/'>https://console.developers.google.com/</a> <p>Visit <a href='https://console.developers.google.com/'>https://console.developers.google.com/</a>
and click "CREATE PROJECT".</p> and click <b>"Create Project"</b>.</p>
<p>Then under "APIs & auth" click on "Credentials", then "CREATE NEW CLIENT ID".</p> <p>Then under "APIs & Auth" in the left sidebar, click on "Credentials", then click the button <b>"Create new Client ID"</b>.</p>
<p>Use the following settings:</p> <p>Use the following settings:</p>
<ul> <ul>
<li>Web application</li> <li>Web application</li>
@ -102,7 +110,7 @@ and click "CREATE PROJECT".</p>
<li>Authorized Redirect URI: <b>%s</b></li> <li>Authorized Redirect URI: <b>%s</b></li>
</ul> </ul>
<p>Click "Create Client ID". Copy the "Client ID" and "Client Secret" into the boxes above.</p> <p>Click "Create Client ID". Copy the "Client ID" and "Client Secret" into the boxes above.</p>
`, base, base+"/callback") `, origin, callback)
} }
// A run is our state for a given run of the importer. // A run is our state for a given run of the importer.