Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
12f8dece
Commit
12f8dece
authored
Nov 13, 2023
by
Evan W. Patton
Committed by
Susan Rati Lane
Apr 18, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address internal error in localhost when adding ChatBot
Change-Id: I3137482dd11767872b0cd3dea06e4c2e180a7a82
parent
0c18ce53
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockChatBot.java
...inventor/client/editor/simple/components/MockChatBot.java
+14
-8
appinventor/appengine/src/com/google/appinventor/server/tokenauth/TokenAuthServiceImpl.java
...le/appinventor/server/tokenauth/TokenAuthServiceImpl.java
+4
-2
No files found.
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockChatBot.java
View file @
12f8dece
...
...
@@ -94,7 +94,7 @@ public class MockChatBot extends MockNonVisibleComponent {
token
.
setType
(
tokenType
);
getTokenFromServer
();
return
;
// Callback from getTokenFromServer finishes up
}
else
if
(
newValue
.
substring
(
0
,
1
)
==
"%"
)
{
}
else
if
(
newValue
.
charAt
(
0
)
==
'%'
)
{
tokenType
&=
~
EditableProperty
.
TYPE_NONPERSISTED
;
}
token
.
setType
(
tokenType
);
...
...
@@ -107,14 +107,20 @@ public class MockChatBot extends MockNonVisibleComponent {
Ode
.
getInstance
().
getTokenAuthService
().
getChatBotToken
(
new
OdeAsyncCallback
<
String
>()
{
@Override
public
void
onSuccess
(
String
token
)
{
EditableProperty
tokenProperty
=
MockChatBot
.
this
.
properties
.
getProperty
(
PROPERTY_NAME_TOKEN
);
if
(
tokenProperty
!=
null
)
{
if
(
token
==
null
)
{
onFailure
(
new
UnsupportedOperationException
(
"Server is not configured to generate ChatBot tokens."
));
return
;
}
EditableProperty
tokenProperty
=
properties
.
getProperty
(
PROPERTY_NAME_TOKEN
);
if
(
tokenProperty
==
null
)
{
return
;
}
String
existingToken
=
tokenProperty
.
getValue
();
if
(!
existingToken
.
isEmpty
())
{
LOG
.
info
(
"bailing on getTokenFromServer existingToken = "
+
existingToken
);
return
;
// If we have a value, don't over-write it
}
}
int
tokenType
=
tokenProperty
.
getType
();
tokenType
|=
EditableProperty
.
TYPE_NONPERSISTED
;
tokenType
|=
EditableProperty
.
TYPE_DOYAIL
;
...
...
appinventor/appengine/src/com/google/appinventor/server/tokenauth/TokenAuthServiceImpl.java
View file @
12f8dece
...
...
@@ -5,6 +5,7 @@
package
com.google.appinventor.server.tokenauth
;
import
com.google.appinventor.server.CrashReport
;
import
com.google.appinventor.server.OdeRemoteServiceServlet
;
import
com.google.appinventor.server.flags.Flag
;
...
...
@@ -17,6 +18,7 @@ import com.google.protobuf.ByteString;
import
java.security.InvalidKeyException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.logging.Logger
;
import
javax.crypto.Mac
;
import
javax.crypto.spec.SecretKeySpec
;
...
...
@@ -58,6 +60,7 @@ import javax.crypto.spec.SecretKeySpec;
*/
public
class
TokenAuthServiceImpl
extends
OdeRemoteServiceServlet
implements
TokenAuthService
{
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
TokenAuthServiceImpl
.
class
.
getName
());
private
String
SECRET_KEY_UUID
=
Flag
.
createFlag
(
"clouddb.uuid.secret"
,
""
).
get
();
private
String
SECRET_KEY_CLOUD_DB
=
Flag
.
createFlag
(
"clouddb.secret"
,
""
).
get
();
...
...
@@ -160,8 +163,7 @@ public class TokenAuthServiceImpl extends OdeRemoteServiceServlet
.
setSignature
(
ByteString
.
copyFrom
(
signature
)).
build
().
toByteArray
();
return
(
Base58Util
.
encode
(
token
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
throw
CrashReport
.
createAndLogError
(
LOG
,
null
,
null
,
e
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment