Skip to content

Commit

Permalink
Add libraries icon
Browse files Browse the repository at this point in the history
  • Loading branch information
slideclimb committed Jul 17, 2022
1 parent 1a47a8d commit dcf4fb4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion resources/META-INF/extensions/tool-windows.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<toolWindow factoryClass="nl.hannahsten.texifyidea.ui.remotelibraries.RemoteLibrariesToolWindowFactory"
id="Libraries" secondary="false" anchor="right" icon="AllIcons.ObjectBrowser.ShowLibraryContents" order="before Symbols"/>
<toolWindow factoryClass="nl.hannahsten.texifyidea.ui.symbols.SymbolToolWindowFactory"
id="Symbols" anchor="right" secondary="false" icon="/nl/hannahsten/texifyidea/icons/symbols.svg" order="before Detexify"/>
<toolWindow factoryClass="nl.hannahsten.texifyidea.ui.DetexifyToolWindowFactory"
id="Detexify" anchor="right" secondary="false" icon="/nl/hannahsten/texifyidea/icons/search_13x13.svg"/>
<toolWindow factoryClass="nl.hannahsten.texifyidea.ui.remotelibraries.RemoteLibrariesToolWindowFactory" id="Remote Libraries" secondary="false" anchor="right"/>
</extensions>

<actions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object MendeleyAuthenticator {
val authorizationServer: NettyApplicationEngine = embeddedServer(Netty, port = port) {
routing {
get("/") {
this.call.respondText("You are now logged in to Mendeley.")
this.call.respondText("You are now logged in to Mendeley. Click OK to continue.")
authenticationCode = call.parameters["code"]
serverRunning = false
this.application.dispose()
Expand Down Expand Up @@ -113,14 +113,20 @@ object MendeleyAuthenticator {
append("refresh_token", PasswordSafe.instance.getPassword(refreshTokenAttributes)!!)
append("redirect_uri", "http://localhost:$port/")
}) {
basicAuth(Mendeley.id, Mendeley.secret)
basicAuth(MendeleyCredentials.id, MendeleyCredentials.secret.decipher())
}.body()

println(MendeleyCredentials.secret)
val (tokenCredentials, refreshTokenCredentials) = token.getCredentials()

return BearerTokens(tokenCredentials.password.toString(), refreshTokenCredentials.password.toString())
}

/**
* Decipher the Mendeley secret...
*/
private fun String.decipher() = toCharArray().map { it.minus(12) }.joinToString("")

/**
* Data class to deserialize Mendeley's response with the access token.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package nl.hannahsten.texifyidea.remotelibraries.mendeley

object MendeleyCredentials {

/**
* TeXiFy id to communicate with Mendeley.
*/
const val id = "13058"

/**
* TeXiFy secret to communicate with Mendeley.
*/
const val secret = "\u0084BA\\U\u0086sTWx`MpuMT"
}

0 comments on commit dcf4fb4

Please sign in to comment.