rollback: cards are now once again stored at user/device/user-device.json

This commit is contained in:
Jan-Piet Mens
2017-07-18 12:08:07 +02:00
parent 06e2eac43b
commit 5d432c69a1
2 changed files with 3 additions and 15 deletions
+2 -2
View File
@@ -92,7 +92,7 @@ int do_info(void *userdata, UT_string *username, UT_string *device, JsonNode *js
/* I know the payload is valid JSON: write card */
if ((fp = pathn("wb", "cards", username, NULL, "json", time(0))) != NULL) {
if ((fp = pathn("wb", "cards", username, device, "json", time(0))) != NULL) {
char *js = json_stringify(json, NULL);
if (js) {
fprintf(fp, "%s\n", js);
@@ -124,7 +124,7 @@ int do_info(void *userdata, UT_string *username, UT_string *device, JsonNode *js
/* We have a base64-encoded "face". Decode it and store binary image */
if ((img = base64_decode(UB(face), &imglen)) != NULL) {
if ((fp = pathn("wb", "photos", username, NULL, "png", time(0))) != NULL) {
if ((fp = pathn("wb", "photos", username, device, "png", time(0))) != NULL) {
fwrite(img, sizeof(char), imglen, fp);
fclose(fp);
}
+1 -13
View File
@@ -490,22 +490,10 @@ FILE *pathn(char *mode, char *prefix, UT_string *user, UT_string *device, char *
return (NULL);
}
#if 0
if (device) {
utstring_printf(path, "/%s-%s.%s",
UB(user), UB(device), suffix);
} else {
utstring_printf(path, "/%s.%s",
UB(user), suffix);
}
#endif
if (strcmp(prefix, "rec") == 0) {
utstring_printf(path, "/%s.%s", yyyymm(epoch), suffix);
} else {
utstring_printf(path, "/%s.%s",
UB(user), suffix);
utstring_printf(path, "/%s-%s.%s", UB(user), UB(device), suffix);
}
ut_clean(path);