inputs.scss refactor
Added upload date to media + sort by date
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
FROM rust:1 AS chef
|
||||
RUN rustup target add wasm32-unknown-unknown
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner
|
||||
COPY . .
|
||||
WORKDIR /app/AobaClient
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder
|
||||
WORKDIR /app/AobaClient
|
||||
COPY --from=planner /app/AobaClient/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY /AobaClient /app/AobaClient
|
||||
COPY /AobaServer/Proto /app/AobaServer/Proto
|
||||
|
||||
# Install Protobuf
|
||||
RUN apt update
|
||||
RUN apt install -y protobuf-compiler libprotobuf-dev
|
||||
|
||||
# Install `dx`
|
||||
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||
RUN cargo binstall dioxus-cli --root /.cargo -y --force
|
||||
ENV PATH="/.cargo/bin:$PATH"
|
||||
|
||||
# Create the final bundle folder. Bundle always executes in release mode with optimizations enabled
|
||||
RUN dx bundle --platform web
|
||||
ENTRYPOINT [ "sleep", "infinity" ]
|
||||
|
||||
|
||||
# FROM chef AS runtime
|
||||
# COPY --from=builder /app/AobaClient/target/dx/aoba-client/release/web/ /usr/local/app
|
||||
|
||||
# # set our port and make sure to listen for all connections
|
||||
# ENV PORT=8616
|
||||
# ENV IP=0.0.0.0
|
||||
|
||||
# # expose the port 8080
|
||||
# EXPOSE 8616
|
||||
|
||||
# WORKDIR /usr/local/app
|
||||
# ENTRYPOINT [ "/usr/local/app/server" ]
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
.searchBar {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
textarea,
|
||||
input[type="url"],
|
||||
input[type="email"],
|
||||
input[type="number"],
|
||||
input[type="tel"],
|
||||
input[type="text"] {
|
||||
}
|
||||
|
||||
.searchBar {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
|
||||
input {
|
||||
padding: 10px;
|
||||
font-size: 1.5rem;
|
||||
border-radius: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@import "mixins";
|
||||
@import "colors";
|
||||
@import "inputs";
|
||||
|
||||
:root {
|
||||
background-color: $mainBGColor;
|
||||
@@ -13,6 +12,11 @@
|
||||
font-variation-settings: "wdth" 100;
|
||||
}
|
||||
|
||||
.stickyTop {
|
||||
top: 0;
|
||||
position: sticky;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ use dioxus::prelude::*;
|
||||
pub fn Search(query: Signal<String>) -> Element {
|
||||
rsx! {
|
||||
div{
|
||||
class: "searchBar",
|
||||
class: "searchBar stickyTop",
|
||||
input {
|
||||
type: "search",
|
||||
placeholder: "Search Files",
|
||||
|
||||
@@ -17,6 +17,7 @@ pub const HOST: &'static str = "https://aoba.app";
|
||||
|
||||
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
||||
const MAIN_CSS: Asset = asset!("/assets/style/main.scss");
|
||||
const INPUT_CSS: Asset = asset!("/assets/style/inputs.scss");
|
||||
|
||||
fn main() {
|
||||
dioxus::launch(App);
|
||||
@@ -30,6 +31,7 @@ fn App() -> Element {
|
||||
document::Link { rel: "preconnect", href: "https://fonts.googleapis.com" }
|
||||
document::Link { rel: "preconnect", href: "https://fonts.gstatic.com" }
|
||||
document::Link { rel: "stylesheet", href: MAIN_CSS }
|
||||
document::Link { rel: "stylesheet", href: INPUT_CSS }
|
||||
document::Link {
|
||||
rel: "stylesheet",
|
||||
href: "https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap",
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="MaybeError" Version="1.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="MongoDB.Analyzer" Version="2.0.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.4.0" />
|
||||
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.10.0" />
|
||||
|
||||
@@ -21,11 +21,12 @@ public class AobaService(IMongoDatabase db)
|
||||
public async Task<PagedResult<Media>> FindMediaAsync(string? query, int page = 1, int pageSize = 100)
|
||||
{
|
||||
var filter = string.IsNullOrWhiteSpace(query) ? "{}" : Builders<Media>.Filter.Text(query);
|
||||
var sort = Builders<Media>.Sort.Descending(m => m.UploadDate);
|
||||
var find = _media.Find(filter);
|
||||
|
||||
var total = await find.CountDocumentsAsync();
|
||||
page -= 1;
|
||||
var items = await find.Skip(page * pageSize).Limit(pageSize).ToListAsync();
|
||||
var items = await find.Sort(sort).Skip(page * pageSize).Limit(pageSize).ToListAsync();
|
||||
return new PagedResult<Media>(items, page, pageSize, total);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
global using MaybeError;
|
||||
global using MaybeError;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
using MongoDB.Driver;
|
||||
@@ -13,9 +13,9 @@ using System.Threading.Tasks;
|
||||
namespace AobaCore;
|
||||
public static class Extensions
|
||||
{
|
||||
public static IServiceCollection AddAoba(this IServiceCollection services)
|
||||
public static IServiceCollection AddAoba(this IServiceCollection services, string dbString)
|
||||
{
|
||||
var settings = MongoClientSettings.FromConnectionString("mongodb://NinoIna:27017");
|
||||
var settings = MongoClientSettings.FromConnectionString(dbString);
|
||||
settings.ClusterConfigurator = cb => cb.Subscribe(new DiagnosticsActivityEventSubscriber());
|
||||
var dbClient = new MongoClient(settings);
|
||||
var db = dbClient.GetDatabase("Aoba");
|
||||
|
||||
@@ -14,6 +14,7 @@ public class Media
|
||||
public string Ext { get; set; }
|
||||
public int ViewCount { get; set; }
|
||||
public ObjectId Owner { get; set; }
|
||||
public DateTime UploadDate { get; set; }
|
||||
|
||||
|
||||
public static readonly Dictionary<string, MediaType> KnownTypes = new()
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<Protobuf Include="Proto\Auth.proto"></Protobuf>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="BuildDioxusClientDebug" BeforeTargets="Build" Condition="'$(Configuration)'=='DEBUG'">
|
||||
<Target Name="BuildDioxusClientDebug" BeforeTargets="Build" Condition="'$(Configuration)'=='B'">
|
||||
<Exec Command="dx build --platform web" WorkingDirectory="..\AobaClient" />
|
||||
<Exec Command="rm -rf wwwroot/*" />
|
||||
<Exec Command="cp -r target\dx\aoba-client\debug\web\public\* ../AobaServer/wwwroot/" WorkingDirectory="..\AobaClient" />
|
||||
|
||||
@@ -42,4 +42,11 @@ public class MediaController(AobaService aobaService, ILogger<MediaController> l
|
||||
return NotFound();
|
||||
return LocalRedirectPermanent($"/m/{media.MediaId}/{rest}");
|
||||
}
|
||||
|
||||
[HttpGet("thumb/{id}")]
|
||||
public async Task<IActionResult> ThumbAsync(ObjectId id)
|
||||
{
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var config = builder.Configuration;
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers(opt => opt.ModelBinderProviders.Add(new BsonIdModelBinderProvider()));
|
||||
|
||||
@@ -70,7 +70,7 @@ builder.Services.AddAuthentication(options =>
|
||||
ctx.Token = ctx.Request.Headers.Authorization.FirstOrDefault()?.Replace("Bearer ", "");
|
||||
|
||||
#if DEBUG //allow cookie based auth when in debug mode
|
||||
if(string.IsNullOrWhiteSpace(ctx.Token))
|
||||
if (string.IsNullOrWhiteSpace(ctx.Token))
|
||||
ctx.Token = ctx.Request.Cookies.FirstOrDefault(c => c.Key == "token").Value;
|
||||
#endif
|
||||
|
||||
@@ -90,7 +90,8 @@ builder.Services.AddAuthentication(options =>
|
||||
};
|
||||
}).AddScheme<AuthenticationSchemeOptions, AobaAuthenticationHandler>("Aoba", null);
|
||||
|
||||
builder.Services.AddAoba();
|
||||
var dbString = config["DB_STRING"];
|
||||
builder.Services.AddAoba(dbString ?? "mongodb://localhost:27017");
|
||||
builder.Services.Configure<FormOptions>(opt =>
|
||||
{
|
||||
opt.ValueLengthLimit = int.MaxValue;
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DB_STRING": "mongodb://NinoIna:27017"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
services:
|
||||
# client:
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: AobaClient/Dockerfile
|
||||
server:
|
||||
aoba:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: AobaServer/Dockerfile
|
||||
|
||||
Reference in New Issue
Block a user