Skip to content

Commit

Permalink
Add a few notes describing the origine of the livereload code and our…
Browse files Browse the repository at this point in the history
… modifications to it
  • Loading branch information
K-Phoen committed Oct 30, 2024
1 parent 18bf2f6 commit 32991db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/livereload/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Original file: https://github.com/gohugoio/hugo/blob/89bd025ebfd2c559039826641702941fc35a7fdb/livereload/connection.go
// No changes were made.

package livereload

Expand Down
3 changes: 3 additions & 0 deletions internal/livereload/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Original file: https://github.com/gohugoio/hugo/blob/89bd025ebfd2c559039826641702941fc35a7fdb/livereload/hub.go
// No changes were made.

package livereload

Expand Down
5 changes: 5 additions & 0 deletions internal/livereload/livereload.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Original file: https://github.com/gohugoio/hugo/blob/89bd025ebfd2c559039826641702941fc35a7fdb/livereload/livereload.go

package livereload

Expand All @@ -21,12 +23,15 @@ import (
)

// Initialize starts the Websocket Hub handling live reloads.
// Original: https://github.com/gohugoio/hugo/blob/89bd025ebfd2c559039826641702941fc35a7fdb/livereload/livereload.go#L107
func Initialize() {
go wsHub.run()
}

// Handler is a HandlerFunc handling the livereload
// Websocket interaction.
// Original: https://github.com/gohugoio/hugo/blob/89bd025ebfd2c559039826641702941fc35a7fdb/livereload/livereload.go#L93-L105
// Our version is modified to accept a websocket upgrader coming from the server.
func Handler(upgrader *websocket.Upgrader) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ws, err := upgrader.Upgrade(w, r, nil)
Expand Down

0 comments on commit 32991db

Please sign in to comment.