Make all resource paths relative

Closes: https://todo.sr.ht/~emersion/gamja/17
This commit is contained in:
Simon Ser 2021-03-02 22:46:48 +01:00
parent a5608a40d5
commit 80e0175d36
14 changed files with 47 additions and 43 deletions

View file

@ -1,4 +1,4 @@
import { SERVER_BUFFER } from "/state.js";
import { SERVER_BUFFER } from "./state.js";
function getActiveClient(app) {
var buf = app.state.buffers.get(app.state.activeBuffer);

View file

@ -1,17 +1,17 @@
import * as irc from "/lib/irc.js";
import Client from "/lib/client.js";
import Buffer from "/components/buffer.js";
import BufferList from "/components/buffer-list.js";
import BufferHeader from "/components/buffer-header.js";
import MemberList from "/components/member-list.js";
import Connect from "/components/connect.js";
import Composer from "/components/composer.js";
import ScrollManager from "/components/scroll-manager.js";
import { html, Component, createRef } from "/lib/index.js";
import { strip as stripANSI } from "/lib/ansi.js";
import { SERVER_BUFFER, BufferType, ReceiptType, NetworkStatus, Unread } from "/state.js";
import commands from "/commands.js";
import { setup as setupKeybindings } from "/keybindings.js";
import * as irc from "../lib/irc.js";
import Client from "../lib/client.js";
import Buffer from "./buffer.js";
import BufferList from "./buffer-list.js";
import BufferHeader from "./buffer-header.js";
import MemberList from "./member-list.js";
import Connect from "./connect.js";
import Composer from "./composer.js";
import ScrollManager from "./scroll-manager.js";
import { html, Component, createRef } from "../lib/index.js";
import { strip as stripANSI } from "../lib/ansi.js";
import { SERVER_BUFFER, BufferType, ReceiptType, NetworkStatus, Unread } from "../state.js";
import commands from "../commands.js";
import { setup as setupKeybindings } from "../keybindings.js";
const CHATHISTORY_MAX_SIZE = 4000;
@ -189,6 +189,10 @@ export default class App extends Component {
if (window.location.protocol != "https:") {
proto = "ws:";
}
var path = window.location.pathname || "/";
if (!window.location.host) {
path = "/";
}
var serverURL;
if (params.server) {
@ -198,7 +202,7 @@ export default class App extends Component {
serverURL = params.server;
}
} else {
serverURL = proto + "//" + host + "/socket";
serverURL = proto + "//" + host + path + "socket";
}
this.state.connectParams.serverURL = serverURL;

View file

@ -1,7 +1,7 @@
import { html, Component } from "/lib/index.js";
import linkify from "/lib/linkify.js";
import { strip as stripANSI } from "/lib/ansi.js";
import { BufferType, NetworkStatus } from "/state.js";
import { html, Component } from "../lib/index.js";
import linkify from "../lib/linkify.js";
import { strip as stripANSI } from "../lib/ansi.js";
import { BufferType, NetworkStatus } from "../state.js";
const UserStatus = {
HERE: "here",

View file

@ -1,6 +1,6 @@
import * as irc from "/lib/irc.js";
import { html, Component } from "/lib/index.js";
import { BufferType, Unread, getBufferURL } from "/state.js";
import * as irc from "../lib/irc.js";
import { html, Component } from "../lib/index.js";
import { BufferType, Unread, getBufferURL } from "../state.js";
function getNetworkName(network) {
var bouncerStr = network.isupport.get("BOUNCER");

View file

@ -1,8 +1,8 @@
import { html, Component } from "/lib/index.js";
import linkify from "/lib/linkify.js";
import * as irc from "/lib/irc.js";
import { strip as stripANSI } from "/lib/ansi.js";
import { BufferType, getNickURL, getMessageURL } from "/state.js";
import { html, Component } from "../lib/index.js";
import linkify from "../lib/linkify.js";
import * as irc from "../lib/irc.js";
import { strip as stripANSI } from "../lib/ansi.js";
import { BufferType, getNickURL, getMessageURL } from "../state.js";
function djb2(s) {
var hash = 5381;

View file

@ -1,4 +1,4 @@
import { html, Component, createRef } from "/lib/index.js";
import { html, Component, createRef } from "../lib/index.js";
export default class Composer extends Component {
state = {

View file

@ -1,4 +1,4 @@
import { html, Component } from "/lib/index.js";
import { html, Component } from "../lib/index.js";
export default class Connect extends Component {
state = {

View file

@ -1,5 +1,5 @@
import { html, Component } from "/lib/index.js";
import { getNickURL } from "/state.js";
import { html, Component } from "../lib/index.js";
import { getNickURL } from "../state.js";
class MemberItem extends Component {
constructor(props) {

View file

@ -1,4 +1,4 @@
import { html, Component } from "/lib/index.js";
import { html, Component } from "../lib/index.js";
var store = new Map();

View file

@ -3,15 +3,15 @@
<head>
<meta charset="utf-8">
<title>gamja IRC client</title>
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<noscript>
<p>Unfortunately gamja requires JavaScript. Please enable it!</p>
</noscript>
<script type="module">
import { html, render } from "/lib/index.js";
import App from "/components/app.js";
import { html, render } from "./lib/index.js";
import App from "./components/app.js";
render(html`<${App}/>`, document.body);
</script>

View file

@ -1,4 +1,4 @@
import { ReceiptType, Unread, SERVER_BUFFER } from "/state.js";
import { ReceiptType, Unread, SERVER_BUFFER } from "./state.js";
export const keybindings = [
{

View file

@ -1,8 +1,8 @@
export * from "/node_modules/preact/dist/preact.module.js";
export * from "../node_modules/preact/dist/preact.module.js";
import { h } from "/node_modules/preact/dist/preact.module.js";
import htm from "/node_modules/htm/dist/htm.module.js";
import { h } from "../node_modules/preact/dist/preact.module.js";
import htm from "../node_modules/htm/dist/htm.module.js";
export const html = htm.bind(h);
import "/node_modules/anchorme/dist/browser/anchorme.min.js";
import "../node_modules/anchorme/dist/browser/anchorme.min.js";
export const anchorme = window.anchorme;

View file

@ -1,4 +1,4 @@
import { anchorme, html } from "/lib/index.js";
import { anchorme, html } from "./index.js";
export default function linkify(text) {
var links = anchorme.list(text);

View file

@ -1,4 +1,4 @@
import Client from "/lib/client.js";
import Client from "./lib/client.js";
export const SERVER_BUFFER = "*";