mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Format code
This commit is contained in:
parent
eb4f88bc60
commit
0439e1f37a
@ -161,7 +161,8 @@ namespace Kyoo.Authentication
|
||||
{
|
||||
if (
|
||||
context.HttpContext.Items["PermissionGroup"]
|
||||
is Group group and not Group.None
|
||||
is Group group
|
||||
and not Group.None
|
||||
)
|
||||
_group = group;
|
||||
else if (_group == Group.None)
|
||||
|
@ -218,22 +218,24 @@ namespace Kyoo.Core.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return File.Open(
|
||||
$"/metadata/user/{userId}.webp",
|
||||
FileMode.Open
|
||||
);
|
||||
return File.Open($"/metadata/user/{userId}.webp", FileMode.Open);
|
||||
}
|
||||
catch (FileNotFoundException) { }
|
||||
catch (DirectoryNotFoundException) { }
|
||||
|
||||
User user = await users.Value.Get(userId);
|
||||
if (user.Email == null) throw new ItemNotFoundException();
|
||||
if (user.Email == null)
|
||||
throw new ItemNotFoundException();
|
||||
using MD5 md5 = MD5.Create();
|
||||
string hash = Convert.ToHexString(md5.ComputeHash(Encoding.ASCII.GetBytes(user.Email))).ToLower();
|
||||
string hash = Convert
|
||||
.ToHexString(md5.ComputeHash(Encoding.ASCII.GetBytes(user.Email)))
|
||||
.ToLower();
|
||||
try
|
||||
{
|
||||
HttpClient client = clientFactory.CreateClient();
|
||||
HttpResponseMessage response = await client.GetAsync($"https://www.gravatar.com/avatar/{hash}.jpg?d=404&s=250");
|
||||
HttpResponseMessage response = await client.GetAsync(
|
||||
$"https://www.gravatar.com/avatar/{hash}.jpg?d=404&s=250"
|
||||
);
|
||||
response.EnsureSuccessStatusCode();
|
||||
return await response.Content.ReadAsStreamAsync();
|
||||
}
|
||||
@ -250,7 +252,8 @@ namespace Kyoo.Core.Controllers
|
||||
try
|
||||
{
|
||||
File.Delete($"/metadata/user/{userId}.webp");
|
||||
} catch { }
|
||||
}
|
||||
catch { }
|
||||
return;
|
||||
}
|
||||
using SKCodec codec = SKCodec.Create(image);
|
||||
|
@ -114,4 +114,3 @@ public class UserApi(ILibraryManager libraryManager, IThumbnailsManager thumbs)
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,13 +8,9 @@ namespace Kyoo.Postgresql.Migrations
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "logo_blurhash",
|
||||
table: "users");
|
||||
migrationBuilder.DropColumn(name: "logo_blurhash", table: "users");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "logo_source",
|
||||
table: "users");
|
||||
migrationBuilder.DropColumn(name: "logo_source", table: "users");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -25,13 +21,15 @@ namespace Kyoo.Postgresql.Migrations
|
||||
table: "users",
|
||||
type: "character varying(32)",
|
||||
maxLength: 32,
|
||||
nullable: true);
|
||||
nullable: true
|
||||
);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "logo_source",
|
||||
table: "users",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
nullable: true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ZodObject, ZodRawShape, z } from "zod";
|
||||
import { ZodTypeAny, z } from "zod";
|
||||
import { Account, AccountP } from "./accounts";
|
||||
import { MMKV } from "react-native-mmkv";
|
||||
|
||||
@ -46,10 +46,10 @@ export const setCookie = (key: string, val?: unknown) => {
|
||||
return null;
|
||||
};
|
||||
|
||||
export const readCookie = <T extends ZodRawShape>(
|
||||
export const readCookie = <T extends ZodTypeAny>(
|
||||
cookies: string | undefined,
|
||||
key: string,
|
||||
parser?: ZodObject<T>,
|
||||
parser?: T,
|
||||
) => {
|
||||
if (!cookies) return null;
|
||||
const name = `${key}=`;
|
||||
|
@ -102,7 +102,7 @@ export const Avatar = forwardRef<
|
||||
alt={alt}
|
||||
width={size}
|
||||
height={size}
|
||||
{...css({ position: "absolute" }) as ImageProps}
|
||||
{...(css({ position: "absolute" }) as ImageProps)}
|
||||
/>
|
||||
</Container>
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user