-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from juntofoundation/dev
Release 0.1.7
- Loading branch information
Showing
18 changed files
with
229 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | ||
path="$HOME/.config/junto" | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
path="$HOME/Library/Application Support/junto" | ||
fi | ||
|
||
echo "Will delete path: $path" | ||
# read -p "IS THIS CORRECT? (y/n) " answer | ||
|
||
# if [[ $answer =~ ^[Yy]$ ]] ; | ||
# then | ||
# echo "Accepted, deleting directory" | ||
rm -rf $path | ||
# else | ||
# echo "Not deleting" | ||
# fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { apolloClient } from "@/main"; | ||
import { LANGUAGES } from "../graphql_queries"; | ||
import ad4m from "@perspect3vism/ad4m-executor"; | ||
|
||
export async function getLanguages(): Promise<ad4m.Language[]> { | ||
return new Promise((resolve, reject) => { | ||
apolloClient | ||
.query<{ languages: ad4m.Language[] }>({ | ||
query: LANGUAGES, | ||
}) | ||
.then((result) => { | ||
resolve(result.data!.languages); | ||
}) | ||
.catch((error) => { | ||
reject(error); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { createProfile } from "@/core/methods/createProfile"; | ||
import { Commit } from "vuex"; | ||
import { ExpressionTypes, State, Profile } from ".."; | ||
import { TimeoutCache } from "../../utils/timeoutCache"; | ||
import type Expression from "@perspect3vism/ad4m/Expression"; | ||
import { getExpression } from "@/core/queries/getExpression"; | ||
|
||
export interface Context { | ||
commit: Commit; | ||
state: State; | ||
} | ||
|
||
export interface Payload { | ||
username: string; | ||
profilePicture: string; | ||
thumbnail: string; | ||
} | ||
|
||
export default async ( | ||
{ commit, state }: Context, | ||
payload: Payload | ||
): Promise<any> => { | ||
commit("setUserProfile", payload); | ||
|
||
try { | ||
const user: Profile | null = state.userProfile; | ||
|
||
const communities = Object.values(state.communities); | ||
const cache = new TimeoutCache<Expression>(1000 * 60 * 5); | ||
|
||
for (const community of communities) { | ||
const profileExpression = community.typedExpressionLanguages.find( | ||
(t) => t.expressionType == ExpressionTypes.ProfileExpression | ||
); | ||
const didExpression = `${ | ||
profileExpression!.languageAddress | ||
}://${state.userDid!}`; | ||
|
||
console.log("profileExpression: ", profileExpression); | ||
|
||
if (profileExpression) { | ||
const exp = await createProfile( | ||
profileExpression.languageAddress, | ||
payload.username, | ||
user!.email, | ||
user!.givenName, | ||
user!.familyName, | ||
payload.profilePicture, | ||
payload.thumbnail | ||
); | ||
|
||
console.log("Created new profileExpression: ", exp); | ||
|
||
const expressionGql = await getExpression(exp); | ||
const profileExp = { | ||
author: expressionGql.author!, | ||
data: JSON.parse(expressionGql.data!), | ||
timestamp: expressionGql.timestamp!, | ||
proof: expressionGql.proof!, | ||
} as Expression; | ||
cache.set(didExpression, profileExp); | ||
} else { | ||
const errorMessage = | ||
"Expected to find profile expression language for this community"; | ||
commit("showDangerToast", { | ||
message: errorMessage, | ||
}); | ||
throw Error(errorMessage); | ||
} | ||
} | ||
} catch (e) { | ||
commit("showDangerToast", { | ||
message: e.message, | ||
}); | ||
throw new Error(e); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.