diff --git a/app/assets/images/furecs/furecs-screenshot.png b/app/assets/images/furecs/furecs-screenshot.png new file mode 100644 index 00000000..304d76ac Binary files /dev/null and b/app/assets/images/furecs/furecs-screenshot.png differ diff --git a/app/controllers/domain/fa/api_controller.rb b/app/controllers/domain/fa/api_controller.rb index 96106a8e..bcaa335f 100644 --- a/app/controllers/domain/fa/api_controller.rb +++ b/app/controllers/domain/fa/api_controller.rb @@ -4,10 +4,10 @@ class Domain::Fa::ApiController < ApplicationController before_action :validate_api_token! skip_before_action :verify_authenticity_token, - only: %i[enqueue_objects object_statuses] + only: %i[enqueue_objects object_statuses similar_users] skip_before_action :validate_api_token!, - only: %i[search_user_names object_statuses] + only: %i[search_user_names object_statuses similar_users] def search_user_names name = params[:name] diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index edcee4ce..737bfabf 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,8 +1,12 @@ # typed: true class PagesController < ApplicationController - skip_before_action :authenticate_user!, only: [:root] + skip_before_action :authenticate_user!, only: %i[root user_script] def root render :root end + + def user_script + render :user_script + end end diff --git a/app/controllers/user_scripts_controller.rb b/app/controllers/user_scripts_controller.rb index ad14dc99..e915cf3d 100644 --- a/app/controllers/user_scripts_controller.rb +++ b/app/controllers/user_scripts_controller.rb @@ -1,6 +1,7 @@ # typed: true class UserScriptsController < ApplicationController skip_before_action :authenticate_user!, only: [:get] + skip_before_action :verify_authenticity_token, only: [:get] ALLOWED_SCRIPTS = %w[object_statuses.user.js furecs.user.js].freeze diff --git a/app/views/pages/root.html.erb b/app/views/pages/root.html.erb index 53983a3d..1c42a31d 100644 --- a/app/views/pages/root.html.erb +++ b/app/views/pages/root.html.erb @@ -14,12 +14,18 @@ <%= link_to "Telegram", "https://t.me/DeltaNoises", target: "_blank", - class: "sky-link" %> + class: "blue-link" %> - <%= link_to "BlueSky", "https://bsky.app/profile/delta.refurrer.com", target: "_blank", - class: "sky-link" %> + class: "blue-link" %> + +
+ New: + Try the <%= link_to "FurAffinity User Recommender", + user_script_path, + class: "blue-link" %> user script to discover similar artists and users!
diff --git a/app/views/pages/user_script.html.erb b/app/views/pages/user_script.html.erb new file mode 100644 index 00000000..ed617572 --- /dev/null +++ b/app/views/pages/user_script.html.erb @@ -0,0 +1,59 @@ +
+

FurAffinity User Recommender

+
+

+ The FurAffinity User Recommender is a user script that helps you discover artists and users similar to ones you already enjoy on FurAffinity. +

+

Features

+ +

Installation

+

+ 1. First, install a userscript manager like + <%= link_to "https://www.tampermonkey.net/", target: "_blank", class: "blue-link" do %> + Tampermonkey + <% end %> + or + <%= link_to "https://violentmonkey.github.io/", target: "_blank", class: "blue-link" do %> + Violentmonkey + <% end %>. +

+

+ 2. Then, <%= link_to "click here", "https://refurrer.com/us/furecs.user.js", class: "blue-link" %> to install the script. +

+
+

Screenshot of the Similar Users section added to a user profile page:

+ <%= image_tag "furecs/furecs-screenshot.png", alt: "Screenshot showing the Similar Users section added by the script", class: "rounded-lg border border-slate-300 shadow-lg" %> +
+

How it Works

+

+ Just like how Twitter's "Who to Follow" or Amazon's "Customers Also Bought" features work, this recommender uses patterns in user behavior to make suggestions. For FurAffinity, this is based on who follows who. +

+ +

+ Think of it like this: if many people who follow your favorite artist also follow another artist, there's a good chance you'll enjoy that other artist's work too! +

+

Just To Note

+

+ The recommendations are based on a snapshot of FurAffinity follow lists that is periodically updated. The current model was last updated on January 10, 2025. This means that very recent changes to who follows who might not be reflected in the recommendations yet. +

+
+

+ For support or suggestions, contact @DeltaNoises on + <%= link_to "Telegram", "https://t.me/DeltaNoises", target: "_blank", class: "blue-link" %>. +

+
+
+
diff --git a/config/routes.rb b/config/routes.rb index 061be3f7..b6df6bc4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,7 @@ Rails.application.routes.draw do sessions: "users/sessions", } root to: "pages#root" + get "user-script", to: "pages#user_script", as: :user_script # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html namespace :api do diff --git a/user_scripts/furecs.user.ts b/user_scripts/furecs.user.ts index 6fc7af25..3e642fd3 100644 --- a/user_scripts/furecs.user.ts +++ b/user_scripts/furecs.user.ts @@ -17,8 +17,6 @@ // ==/UserScript== 'use strict'; -// const HOST = 'https://refurrer.com'; -const HOST = 'http://localhost:3001'; interface SimilarUserList { name: string; @@ -58,6 +56,8 @@ function urlNameFromUserHref(href: string) { } async function faUserRecs(): Promise { + const HOST = 'https://refurrer.com'; + if (!window.location.pathname.startsWith('/user/')) { return null; } diff --git a/user_scripts/object_statuses.user.ts b/user_scripts/object_statuses.user.ts index 6bc09bb8..1ceab03b 100644 --- a/user_scripts/object_statuses.user.ts +++ b/user_scripts/object_statuses.user.ts @@ -70,15 +70,15 @@ interface LiveEntityStatTable { } async function faObjectStatuses() { - function isNotNull(val: T | null | undefined): val is T { - return val != null; - } - const HOST = 'refurrer.com'; const LIGHT_BG_COLOR = '#353b45'; const DARK_BG_COLOR = '#20242a'; const LIGHT_BORDER_COLOR = '#69697d'; + function isNotNull(val: T | null | undefined): val is T { + return val != null; + } + function setupNavbar(): HTMLElement { const navbarCssElem = document.createElement('style'); const navbarHeight = '60px';