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 {
|
label {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
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 "mixins";
|
||||||
@import "colors";
|
@import "colors";
|
||||||
@import "inputs";
|
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
background-color: $mainBGColor;
|
background-color: $mainBGColor;
|
||||||
@@ -13,6 +12,11 @@
|
|||||||
font-variation-settings: "wdth" 100;
|
font-variation-settings: "wdth" 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stickyTop {
|
||||||
|
top: 0;
|
||||||
|
position: sticky;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use dioxus::prelude::*;
|
|||||||
pub fn Search(query: Signal<String>) -> Element {
|
pub fn Search(query: Signal<String>) -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
div{
|
div{
|
||||||
class: "searchBar",
|
class: "searchBar stickyTop",
|
||||||
input {
|
input {
|
||||||
type: "search",
|
type: "search",
|
||||||
placeholder: "Search Files",
|
placeholder: "Search Files",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ pub const HOST: &'static str = "https://aoba.app";
|
|||||||
|
|
||||||
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
||||||
const MAIN_CSS: Asset = asset!("/assets/style/main.scss");
|
const MAIN_CSS: Asset = asset!("/assets/style/main.scss");
|
||||||
|
const INPUT_CSS: Asset = asset!("/assets/style/inputs.scss");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
dioxus::launch(App);
|
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.googleapis.com" }
|
||||||
document::Link { rel: "preconnect", href: "https://fonts.gstatic.com" }
|
document::Link { rel: "preconnect", href: "https://fonts.gstatic.com" }
|
||||||
document::Link { rel: "stylesheet", href: MAIN_CSS }
|
document::Link { rel: "stylesheet", href: MAIN_CSS }
|
||||||
|
document::Link { rel: "stylesheet", href: INPUT_CSS }
|
||||||
document::Link {
|
document::Link {
|
||||||
rel: "stylesheet",
|
rel: "stylesheet",
|
||||||
href: "https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap",
|
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="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
|
||||||
<PackageReference Include="MaybeError" Version="1.1.0" />
|
<PackageReference Include="MaybeError" Version="1.1.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.5" />
|
<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" Version="3.4.0" />
|
||||||
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.0.0" />
|
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.0.0" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.10.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)
|
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 filter = string.IsNullOrWhiteSpace(query) ? "{}" : Builders<Media>.Filter.Text(query);
|
||||||
|
var sort = Builders<Media>.Sort.Descending(m => m.UploadDate);
|
||||||
var find = _media.Find(filter);
|
var find = _media.Find(filter);
|
||||||
|
|
||||||
var total = await find.CountDocumentsAsync();
|
var total = await find.CountDocumentsAsync();
|
||||||
page -= 1;
|
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);
|
return new PagedResult<Media>(items, page, pageSize, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
global using MaybeError;
|
global using MaybeError;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
@@ -13,9 +13,9 @@ using System.Threading.Tasks;
|
|||||||
namespace AobaCore;
|
namespace AobaCore;
|
||||||
public static class Extensions
|
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());
|
settings.ClusterConfigurator = cb => cb.Subscribe(new DiagnosticsActivityEventSubscriber());
|
||||||
var dbClient = new MongoClient(settings);
|
var dbClient = new MongoClient(settings);
|
||||||
var db = dbClient.GetDatabase("Aoba");
|
var db = dbClient.GetDatabase("Aoba");
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public class Media
|
|||||||
public string Ext { get; set; }
|
public string Ext { get; set; }
|
||||||
public int ViewCount { get; set; }
|
public int ViewCount { get; set; }
|
||||||
public ObjectId Owner { get; set; }
|
public ObjectId Owner { get; set; }
|
||||||
|
public DateTime UploadDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public static readonly Dictionary<string, MediaType> KnownTypes = new()
|
public static readonly Dictionary<string, MediaType> KnownTypes = new()
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<Protobuf Include="Proto\Auth.proto"></Protobuf>
|
<Protobuf Include="Proto\Auth.proto"></Protobuf>
|
||||||
</ItemGroup>
|
</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="dx build --platform web" WorkingDirectory="..\AobaClient" />
|
||||||
<Exec Command="rm -rf wwwroot/*" />
|
<Exec Command="rm -rf wwwroot/*" />
|
||||||
<Exec Command="cp -r target\dx\aoba-client\debug\web\public\* ../AobaServer/wwwroot/" WorkingDirectory="..\AobaClient" />
|
<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 NotFound();
|
||||||
return LocalRedirectPermanent($"/m/{media.MediaId}/{rest}");
|
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;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
var config = builder.Configuration;
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllers(opt => opt.ModelBinderProviders.Add(new BsonIdModelBinderProvider()));
|
builder.Services.AddControllers(opt => opt.ModelBinderProviders.Add(new BsonIdModelBinderProvider()));
|
||||||
|
|
||||||
@@ -90,7 +90,8 @@ builder.Services.AddAuthentication(options =>
|
|||||||
};
|
};
|
||||||
}).AddScheme<AuthenticationSchemeOptions, AobaAuthenticationHandler>("Aoba", null);
|
}).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 =>
|
builder.Services.Configure<FormOptions>(opt =>
|
||||||
{
|
{
|
||||||
opt.ValueLengthLimit = int.MaxValue;
|
opt.ValueLengthLimit = int.MaxValue;
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"DB_STRING": "mongodb://NinoIna:27017"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
services:
|
services:
|
||||||
# client:
|
aoba:
|
||||||
# build:
|
|
||||||
# context: .
|
|
||||||
# dockerfile: AobaClient/Dockerfile
|
|
||||||
server:
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: AobaServer/Dockerfile
|
dockerfile: AobaServer/Dockerfile
|
||||||
|
|||||||
Reference in New Issue
Block a user