Skip to content

Commit

Permalink
fix elvui imports, add chinese lang
Browse files Browse the repository at this point in the history
  • Loading branch information
oratory committed Nov 25, 2017
1 parent b6ff269 commit 788d4df
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 31 deletions.
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
# Wago v3

Code is updated to version 3 of wago.io, currently found on the beta site https://t1000.wago.io (accessible to Patreon'ers).
Wago version 3 found at https://wago.io

# What's new?

There are a ton of changes behind the scenes but also more than a few cosmetic and usability upgrades in place at the user level:

1. On the go? Wago.io is now (mostly) mobile-friendly! The editor will be hidden by default on small devices so you can quickly review and respond to any comments.
1. The menus are more colorful and easier to distinguish each section and quickly find what you're looking for. The icons are provided by the wonderful people at http://game-icons.net/.
1. Search is now context sensitive. You can use keywords to search for users, tags or to enable certain options. Example search for `user: Ora` and you will see my profile. The built-in searches use these as well so dig around and find some more. I'll write up a detailed list soon.
1. Users now have avatars. Set yours on the account page! By default all users are given a randomly generated avatar from the lovely people at http://avatars.adorable.io/.
1. All dates and times are now local to your own timezone.
1. Screenshots and videos can be sorted.

Additionally, Wago is now setup up to support internationalization! If you're interested in volunteering to translate to your language then check out the [translation doc](translation.md) and find me on Discord.
Wago is now setup up to support internationalization! If you're interested in volunteering to translate to your language then check out the [translation doc](translation.md) and find me on Discord.
27 changes: 23 additions & 4 deletions backend/api/lua/wago.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ end

-- elvui
function Decode(dataString)
local profileType, profileKey, profileData, message
local profileInfo, profileType, profileKey, profileData, message
local stringType = GetImportStringType(dataString)

if stringType == "Base64" then
Expand All @@ -146,20 +146,39 @@ function Decode(dataString)
end

local serializedData, success
serializedData, profileType, profileKey = SplitString(decompressedData, "::")
serializedData, profileInfo = SplitString(decompressedData, "^^::") -- "^^" indicates the end of the AceSerializer string

if not profileInfo then
print("Error importing profile. String is invalid or corrupted!")
return
end

serializedData = string.format("%s%s", serializedData, "^^") --Add back the AceSerializer terminator
profileType, profileKey = SplitString(profileInfo, "::")
success, profileData = Serializer:Deserialize(serializedData)

if not success then
print("Error deserializing:", profileData)
return
end
elseif stringType == "Table" then
local profileDataAsString
profileDataAsString, profileType, profileKey = SplitString(dataString, "::")
profileDataAsString, profileInfo = SplitString(dataString, "}::") -- "}::" indicates the end of the table

if not profileInfo then
print("Error extracting profile info. Invalid import string!")
return
end

if not profileDataAsString then
print("Error extracting profile data. Invalid import string!")
return
end

profileDataAsString = string.format("%s%s", profileDataAsString, "}") --Add back the missing "}"
profileDataAsString = string.gsub(profileDataAsString, "\124\124", "\124") --Remove escape pipe characters
profileType, profileKey = SplitString(profileInfo, "::")

local profileToTable = loadstring(string.format("%s %s", "return", profileDataAsString))
if profileToTable then
message, profileData = pcall(profileToTable)
Expand All @@ -172,7 +191,7 @@ function Decode(dataString)
end

--return profileType, profileKey, profileData
return profileData
return profileData

end

Expand Down
7 changes: 4 additions & 3 deletions backend/api/services/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,16 @@ function oAuthLogin(req, res, provider, authUser) {
break

case 'facebook':
if (authUser.email && authUser.email.length > 2) {
query = {"$or": {"facebook.email": authUser.email}}
// id is not synced with previous version of wago, prefer to use email for lookups instead but somehow email is not always provided...? FB option somewhere?
if (authUser.email) {
query = {"facebook.email": authUser.email}
}
else {
query = {"facebook.id": authUser.id}
}

profile = {
id: authUser.id, // not synced with previous version of wago, need to use email for lookups instead
id: authUser.id,
name: authUser.name,
email: authUser.email
}
Expand Down
18 changes: 12 additions & 6 deletions backend/api/services/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ function ScanImport (req, res, next, test) {
}
}
catch (e) {
console.error('Error reading ElvUI JSON', e)
return res.send({error: 'invalid_import'})
console.error('Error reading ElvUI JSON', e, result.stdout)
return res.send({error: result.stdout})
}
})
}
Expand Down Expand Up @@ -673,8 +673,11 @@ function SaveWagoVersion (req, res, mode) {

code.save().then(() => {
if (mode === 'update') {
// look for any discord actions

wago.modified = new Date()
wago.save().then(() => {
// look for any discord actions
discord.onUpdate(req.user, wago)
})
}
res.send({success: true})
})
Expand Down Expand Up @@ -711,8 +714,11 @@ function SaveWagoVersion (req, res, mode) {

code.save().then(() => {
if (mode === 'update') {
// look for any discord actions

wago.modified = new Date()
wago.save().then(() => {
// look for any discord actions
discord.onUpdate(req.user, wago)
})
}
res.send({success: true, wagoID: wago._id})
})
Expand Down
10 changes: 5 additions & 5 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eplan-backend",
"version": "1.0.0",
"description": "Backend service for ePlan Advantage",
"name": "wago.io",
"version": "3.0.0",
"description": "API server for wago.io",
"main": "server.js",
"dependencies": {
"async": "^2.6.0",
Expand Down Expand Up @@ -48,6 +48,6 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "WPS Disaster Management Solutions",
"license": "ISC"
"author": "Mark Bosley",
"license": "MIT"
}
3 changes: 2 additions & 1 deletion i18nLocaleConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
{ 'code': 'en-US', 'lang': 'English' },
{ 'code': 'es-ES', 'lang': 'Español' },
{ 'code': 'fr-FR', 'lang': 'Français' },
{ 'code': 'ru-RU', 'lang': 'Русский' }
{ 'code': 'ru-RU', 'lang': 'Русский' },
{ 'code': 'zh-TW', 'lang': '简体中文' }
]
}
2 changes: 1 addition & 1 deletion translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The following is the status of supported and to-be-supported languages (as of th
| Korean | ✔️ Included | 30% | ❌ No one |
| Portuguese | ✔️ Included | 30% | ❌ No one |
| Russian | ✔️ Included | 94% | Translit |
| Simplified Chinese | ✔️ Included | 30% | ❌ No one |
| Simplified Chinese | ✔️ Included | 100% | biggy0214 |
| Spanish | ✔️ Included | 94% | Krich |
| Swedish | 😞 Not included | 21% | Hukk |

Expand Down

0 comments on commit 788d4df

Please sign in to comment.