mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-23 11:26:16 +00:00
rollback: cards are now once again stored at user/device/user-device.json
This commit is contained in:
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user